Skip to content

Commit cc44e1c

Browse files
committed
Merge remote-tracking branch 'origin/stable' into sync-constructors-backport
2 parents 60d7953 + 5632cad commit cc44e1c

File tree

6 files changed

+91
-80
lines changed

6 files changed

+91
-80
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* text=auto eol=lf
2+
13
dist/source-map.debug.js binary
24
dist/source-map.js binary
35
dist/source-map.min.js binary
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Continuous Integration
2+
on:
3+
# branches pushed by collaborators
4+
push:
5+
branches:
6+
- master
7+
# pull request from non-collaborators
8+
pull_request: {}
9+
# nightly
10+
schedule:
11+
- cron: '0 0 * * *'
12+
jobs:
13+
build:
14+
name: "Test: ${{ matrix.os }}, node ${{ matrix.node }}"
15+
runs-on: ${{ matrix.os }}-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu, windows]
20+
node:
21+
- 16
22+
- 14
23+
- 12
24+
steps:
25+
# checkout code
26+
- uses: actions/checkout@v2
27+
# install node
28+
- name: Use Node.js ${{ matrix.os }}
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ matrix.node }}
32+
33+
# npm install with caching
34+
- run: |
35+
npm config set cache "$( node -p "process.cwd()" )/temp/npm-cache"
36+
- name: Cache dependencies
37+
uses: actions/cache@v2
38+
with:
39+
path: temp/npm-cache
40+
key: npm-cache-${{ matrix.os }} ${{ matrix.node }}-${{ hashFiles('package-lock.json') }}
41+
# restore-keys: npm-cache-${{ matrix.os }} ${{ matrix.node }}-
42+
- run: npm install
43+
44+
# Run tests
45+
- run: npm run coverage
46+
47+
# Upload coverage
48+
- run: npm run coverage-report
49+
if: ${{ always() }}
50+
- name: Codecov
51+
if: ${{ always() }}
52+
uses: codecov/codecov-action@v1
53+
with:
54+
flags: ${{ matrix.os }},node_${{ matrix.node }}

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Source Map
22

3-
[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map)
4-
5-
[![Coverage Status](https://coveralls.io/repos/github/mozilla/source-map/badge.svg)](https://coveralls.io/github/mozilla/source-map)
6-
7-
[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map)
3+
[![Build status](https://img.shields.io/github/workflow/status/cspotcode/source-map/Continuous%20Integration)](https://github.com/cspotcode/source-map/actions?query=workflow%3A%22Continuous+Integration%22)
4+
[![Test coverage](https://codecov.io/gh/cspotcode/source-map/branch/master/graph/badge.svg)](https://codecov.io/gh/cspotcode/source-map)
5+
[![NPM](https://nodei.co/npm/@cspotcode/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/@cspotcode/source-map)
86

97
This is a library to generate and consume the source map format
108
[described here][format].
@@ -13,7 +11,7 @@ This is a library to generate and consume the source map format
1311

1412
## Use with Node
1513

16-
$ npm install source-map
14+
$ npm install @cspotcode/source-map
1715

1816
## Use on the Web
1917

lib/read-wasm.js

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,25 @@
1-
if (typeof fetch === "function") {
2-
// Web version of reading a wasm file into an array buffer.
1+
// Node version of reading a wasm file into an array buffer.
2+
const fs = require("fs");
3+
const path = require("path");
34

4-
let mappingsWasmUrl = null;
5-
6-
module.exports = function readWasm() {
7-
if (typeof mappingsWasmUrl !== "string") {
8-
throw new Error("You must provide the URL of lib/mappings.wasm by calling " +
9-
"SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) " +
10-
"before using SourceMapConsumer");
11-
}
12-
13-
return fetch(mappingsWasmUrl)
14-
.then(response => response.arrayBuffer());
15-
};
16-
17-
module.exports.initialize = url => mappingsWasmUrl = url;
18-
} else {
19-
// Node version of reading a wasm file into an array buffer.
20-
const fs = require("fs");
21-
const path = require("path");
22-
23-
module.exports = function readWasm() {
24-
return new Promise((resolve, reject) => {
25-
const wasmPath = path.join(__dirname, "mappings.wasm");
26-
fs.readFile(wasmPath, null, (error, data) => {
27-
if (error) {
28-
reject(error);
29-
return;
30-
}
5+
module.exports = function readWasm() {
6+
return new Promise((resolve, reject) => {
7+
const wasmPath = path.join(__dirname, "mappings.wasm");
8+
fs.readFile(wasmPath, null, (error, data) => {
9+
if (error) {
10+
reject(error);
11+
return;
12+
}
3113

32-
resolve(data.buffer);
33-
});
14+
resolve(data.buffer);
3415
});
35-
};
36-
module.exports.sync = function readWasmSync() {
37-
const wasmPath = path.join(__dirname, "mappings.wasm");
38-
return fs.readFileSync(wasmPath).buffer;
39-
};
16+
});
17+
};
18+
module.exports.sync = function readWasmSync() {
19+
const wasmPath = path.join(__dirname, "mappings.wasm");
20+
return fs.readFileSync(wasmPath).buffer;
21+
};
4022

41-
module.exports.initialize = _ => {
42-
console.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
43-
};
44-
}
23+
module.exports.initialize = _ => {
24+
console.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
25+
};

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
2-
"name": "source-map",
2+
"name": "@cspotcode/source-map",
33
"description": "Generates and consumes source maps",
44
"version": "0.7.3",
5-
"homepage": "https://github.com/mozilla/source-map",
6-
"author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",
5+
"homepage": "https://github.com/cspotcode/source-map",
6+
"author": "Andrew Bradley <cspotcode@gmail.com>",
77
"contributors": [
8+
"Nick Fitzgerald <[email protected]>",
89
"Tobias Koppers <[email protected]>",
910
"Duncan Beevers <[email protected]>",
1011
"Stephen Crane <[email protected]>",
@@ -44,18 +45,17 @@
4445
],
4546
"repository": {
4647
"type": "git",
47-
"url": "http://github.com/mozilla/source-map.git"
48+
"url": "http://github.com/cspotcode/source-map.git"
4849
},
4950
"main": "./source-map.js",
5051
"types": "./source-map.d.ts",
5152
"files": [
52-
"source-map.js",
53-
"source-map.d.ts",
54-
"lib/",
55-
"dist/source-map.js"
53+
"/source-map.js",
54+
"/source-map.d.ts",
55+
"/lib/"
5656
],
5757
"engines": {
58-
"node": ">= 8"
58+
"node": ">= 12"
5959
},
6060
"license": "BSD-3-Clause",
6161
"scripts": {
@@ -66,6 +66,7 @@
6666
"test": "node test/run-tests.js",
6767
"precoverage": "npm run build",
6868
"coverage": "nyc node test/run-tests.js",
69+
"coverage-report": "nyc report --reporter=lcov",
6970
"setup": "mkdir -p coverage && cp -n .waiting.html coverage/index.html || true",
7071
"dev:live": "live-server --port=4103 --ignorePattern='(js|css|png)$' coverage",
7172
"dev:watch": "watch 'npm run coverage' lib/ test/",

0 commit comments

Comments
 (0)