@atlaspack/utils 2.15.4-typescript-de860656a.0 → 2.15.4-typescript-8a6ec6c8b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +37344 -465
- package/lib/index.js.map +1 -0
- package/package.json +9 -9
- package/lib/DefaultMap.js +0 -46
- package/lib/Deferred.js +0 -30
- package/lib/PromiseQueue.js +0 -112
- package/lib/TapStream.js +0 -34
- package/lib/alternatives.js +0 -116
- package/lib/ansi-html.js +0 -18
- package/lib/blob.js +0 -40
- package/lib/bundle-url.js +0 -34
- package/lib/collection.js +0 -111
- package/lib/config.js +0 -172
- package/lib/countLines.js +0 -15
- package/lib/debounce.js +0 -18
- package/lib/debug-tools.js +0 -36
- package/lib/dependency-location.js +0 -21
- package/lib/escape-html.js +0 -22
- package/lib/generateBuildMetrics.js +0 -121
- package/lib/generateCertificate.js +0 -129
- package/lib/getCertificate.js +0 -18
- package/lib/getExisting.js +0 -25
- package/lib/getModuleParts.js +0 -30
- package/lib/getRootDir.js +0 -52
- package/lib/glob.js +0 -110
- package/lib/hash.js +0 -50
- package/lib/http-server.js +0 -85
- package/lib/is-url.js +0 -22
- package/lib/isDirectoryInside.js +0 -18
- package/lib/objectHash.js +0 -27
- package/lib/openInBrowser.js +0 -74
- package/lib/parseCSSImport.js +0 -15
- package/lib/path.js +0 -39
- package/lib/prettifyTime.js +0 -9
- package/lib/prettyDiagnostic.js +0 -136
- package/lib/progress-message.js +0 -27
- package/lib/relativeBundlePath.js +0 -22
- package/lib/relativeUrl.js +0 -24
- package/lib/replaceBundleReferences.js +0 -199
- package/lib/schema.js +0 -336
- package/lib/shared-buffer.js +0 -27
- package/lib/sourcemap.js +0 -127
- package/lib/stream.js +0 -76
- package/lib/throttle.js +0 -15
- package/lib/urlJoin.js +0 -35
package/lib/stream.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.blobToStream = blobToStream;
|
|
7
|
-
exports.bufferStream = bufferStream;
|
|
8
|
-
exports.fallbackStream = fallbackStream;
|
|
9
|
-
exports.measureStreamLength = measureStreamLength;
|
|
10
|
-
exports.readableFromStringOrBuffer = readableFromStringOrBuffer;
|
|
11
|
-
exports.streamFromPromise = streamFromPromise;
|
|
12
|
-
function _stream() {
|
|
13
|
-
const data = require("stream");
|
|
14
|
-
_stream = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
function measureStreamLength(stream) {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
let length = 0;
|
|
22
|
-
stream.on('data', chunk => {
|
|
23
|
-
length += chunk;
|
|
24
|
-
});
|
|
25
|
-
stream.on('end', () => resolve(length));
|
|
26
|
-
stream.on('error', reject);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function readableFromStringOrBuffer(str) {
|
|
30
|
-
// https://stackoverflow.com/questions/12755997/how-to-create-streams-from-string-in-node-js
|
|
31
|
-
const stream = new (_stream().Readable)();
|
|
32
|
-
stream.push(str);
|
|
33
|
-
stream.push(null);
|
|
34
|
-
return stream;
|
|
35
|
-
}
|
|
36
|
-
function bufferStream(stream) {
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
let buf = Buffer.from([]);
|
|
39
|
-
stream.on('data', data => {
|
|
40
|
-
buf = Buffer.concat([buf, data]);
|
|
41
|
-
});
|
|
42
|
-
stream.on('end', () => {
|
|
43
|
-
resolve(buf);
|
|
44
|
-
});
|
|
45
|
-
stream.on('error', reject);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function blobToStream(blob) {
|
|
49
|
-
if (blob instanceof _stream().Readable) {
|
|
50
|
-
return blob;
|
|
51
|
-
}
|
|
52
|
-
return readableFromStringOrBuffer(blob);
|
|
53
|
-
}
|
|
54
|
-
function streamFromPromise(promise) {
|
|
55
|
-
const stream = new (_stream().PassThrough)();
|
|
56
|
-
promise.then(blob => {
|
|
57
|
-
if (blob instanceof _stream().Readable) {
|
|
58
|
-
blob.pipe(stream);
|
|
59
|
-
} else {
|
|
60
|
-
stream.end(blob);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return stream;
|
|
64
|
-
}
|
|
65
|
-
function fallbackStream(stream, fallback) {
|
|
66
|
-
const res = new (_stream().PassThrough)();
|
|
67
|
-
stream.on('error', err => {
|
|
68
|
-
if (err.code === 'ENOENT') {
|
|
69
|
-
fallback().pipe(res);
|
|
70
|
-
} else {
|
|
71
|
-
res.emit('error', err);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
stream.pipe(res);
|
|
75
|
-
return res;
|
|
76
|
-
}
|
package/lib/throttle.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = throttle;
|
|
7
|
-
function throttle(fn, delay) {
|
|
8
|
-
let lastCalled;
|
|
9
|
-
return function throttled(...args) {
|
|
10
|
-
if (lastCalled == null || lastCalled + delay <= Date.now()) {
|
|
11
|
-
fn.call(this, ...args);
|
|
12
|
-
lastCalled = Date.now();
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
package/lib/urlJoin.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = urlJoin;
|
|
7
|
-
function _url() {
|
|
8
|
-
const data = _interopRequireDefault(require("url"));
|
|
9
|
-
_url = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _path() {
|
|
15
|
-
const data = _interopRequireDefault(require("path"));
|
|
16
|
-
_path = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
/**
|
|
23
|
-
* Joins a path onto a URL, and normalizes Windows paths
|
|
24
|
-
* e.g. from \path\to\res.js to /path/to/res.js.
|
|
25
|
-
*/
|
|
26
|
-
function urlJoin(publicURL, assetPath) {
|
|
27
|
-
const url = _url().default.parse(publicURL, false, true);
|
|
28
|
-
// Leading / ensures that paths with colons are not parsed as a protocol.
|
|
29
|
-
let p = assetPath.startsWith('/') ? assetPath : '/' + assetPath;
|
|
30
|
-
const assetUrl = _url().default.parse(p);
|
|
31
|
-
url.pathname = _path().default.posix.join(url.pathname, assetUrl.pathname);
|
|
32
|
-
url.search = assetUrl.search;
|
|
33
|
-
url.hash = assetUrl.hash;
|
|
34
|
-
return _url().default.format(url);
|
|
35
|
-
}
|