cbst 0.2.1 → 0.2.2
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/CHANGELOG.md +6 -0
- package/dist/CacheBuster.d.ts +1 -0
- package/dist/CacheBuster.js +5 -2
- package/dist/bin.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/CacheBuster.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export declare class CacheBuster extends EventEmitter {
|
|
|
78
78
|
handleReferenceError(error: Error, source: string, reference: string): void;
|
|
79
79
|
getReferences(file: string): Promise<string[]>;
|
|
80
80
|
isResolvableReference(reference: string): boolean;
|
|
81
|
+
isExternalReference(reference: string): boolean;
|
|
81
82
|
resolveReference(base: string, reference: string): string;
|
|
82
83
|
getBase(file: string): Promise<string>;
|
|
83
84
|
formatVersion(hash: string): string;
|
package/dist/CacheBuster.js
CHANGED
|
@@ -21,7 +21,7 @@ class CacheBuster extends events_1.default {
|
|
|
21
21
|
this.map = new Map();
|
|
22
22
|
this.unresolved = new Map();
|
|
23
23
|
this.referenceRx = /((")(([^"\s]+)\.([a-zA-Z0-9]+))")|((')(([^'\s]+)\.([a-zA-Z0-9]+))')|# sourceMappingURL=(([^\s]+)\.([a-zA-Z0-9]+))/g;
|
|
24
|
-
this.externalReferenceRx = /^([a-zA-Z0-9]
|
|
24
|
+
this.externalReferenceRx = /^([a-zA-Z][a-zA-Z0-9+.\-]*:|\/\/)/;
|
|
25
25
|
this.baseRx = /<base[^<>]+href\s*=\s*"([^"]+)"[^<>]*>/i;
|
|
26
26
|
this.extensionRx = /(?<=\.)[^.]+$/;
|
|
27
27
|
const o = { ...CacheBuster.defaultConfig, ...options };
|
|
@@ -151,7 +151,10 @@ class CacheBuster extends events_1.default {
|
|
|
151
151
|
return references;
|
|
152
152
|
}
|
|
153
153
|
isResolvableReference(reference) {
|
|
154
|
-
return !reference.match(
|
|
154
|
+
return (!this.isExternalReference(reference) && !this.excludeGlob.match(reference));
|
|
155
|
+
}
|
|
156
|
+
isExternalReference(reference) {
|
|
157
|
+
return !!reference.match(this.externalReferenceRx);
|
|
155
158
|
}
|
|
156
159
|
resolveReference(base, reference) {
|
|
157
160
|
if (reference[0] === '/')
|
package/dist/bin.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const CacheBusterCli_1 = require("./CacheBusterCli");
|
|
5
5
|
const cli = new CacheBusterCli_1.CacheBusterCli();
|
|
6
|
-
cli.run(process.argv.slice(2));
|
|
6
|
+
cli.run(process.argv.slice(2)).then((exitCode) => process.exit(exitCode));
|