static-file-mapper 0.3.0 → 0.3.3
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/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Static File Mapper
|
|
1
|
+
# Static File Mapper
|
|
2
2
|
|
|
3
|
-
Helps with managing static files for frontend deployments.
|
|
3
|
+
Helps with managing static files for frontend deployments.
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export interface StaticFileMapping {
|
|
2
|
-
|
|
3
|
-
generatedName: string;
|
|
4
|
-
}
|
|
5
|
-
export declare type MappingStore = StaticFileMapping[];
|
|
6
|
-
/**
|
|
7
|
-
* Allows resolving static file mappings.
|
|
8
|
-
*/
|
|
9
|
-
export interface StaticFileMapper {
|
|
10
|
-
resolve({ name }: {
|
|
11
|
-
name: string;
|
|
12
|
-
}): Promise<string>;
|
|
13
|
-
has({ name }: {
|
|
14
|
-
name: string;
|
|
15
|
-
}): Promise<boolean>;
|
|
16
|
-
}
|
|
17
|
-
export declare class StaticFileMapperRun implements StaticFileMapper {
|
|
18
|
-
private store;
|
|
19
|
-
private baseUrl;
|
|
20
|
-
private readStore;
|
|
21
|
-
has({ name }: {
|
|
22
|
-
name: string;
|
|
23
|
-
}): Promise<boolean>;
|
|
24
|
-
resolve({ name }: {
|
|
25
|
-
name: string;
|
|
26
|
-
}): Promise<string>;
|
|
27
|
-
constructor({ store, baseUrl }: {
|
|
28
|
-
store: MappingStore;
|
|
29
|
-
baseUrl: string;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
1
|
+
export interface StaticFileMapping {
|
|
2
|
+
names: string[];
|
|
3
|
+
generatedName: string;
|
|
4
|
+
}
|
|
5
|
+
export declare type MappingStore = StaticFileMapping[];
|
|
6
|
+
/**
|
|
7
|
+
* Allows resolving static file mappings.
|
|
8
|
+
*/
|
|
9
|
+
export interface StaticFileMapper {
|
|
10
|
+
resolve({ name }: {
|
|
11
|
+
name: string;
|
|
12
|
+
}): Promise<string>;
|
|
13
|
+
has({ name }: {
|
|
14
|
+
name: string;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
export declare class StaticFileMapperRun implements StaticFileMapper {
|
|
18
|
+
private store;
|
|
19
|
+
private baseUrl;
|
|
20
|
+
private readStore;
|
|
21
|
+
has({ name }: {
|
|
22
|
+
name: string;
|
|
23
|
+
}): Promise<boolean>;
|
|
24
|
+
resolve({ name }: {
|
|
25
|
+
name: string;
|
|
26
|
+
}): Promise<string>;
|
|
27
|
+
constructor({ store, baseUrl }: {
|
|
28
|
+
store: MappingStore;
|
|
29
|
+
baseUrl: string;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
32
|
//# sourceMappingURL=staticFileMapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticFileMapper.d.ts","sourceRoot":"","sources":["../../src/staticFileMapper.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,
|
|
1
|
+
{"version":3,"file":"staticFileMapper.d.ts","sourceRoot":"","sources":["../../src/staticFileMapper.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,oBAAY,YAAY,GAAG,iBAAiB,EAAE,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnD;AAED,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,SAAS;IAIJ,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjD,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;gBAYrD,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAAE,KAAK,EAAE,YAAY,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAIzE"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StaticFileMapperRun = void 0;
|
|
4
|
-
class StaticFileMapperRun {
|
|
5
|
-
constructor({ store, baseUrl }) {
|
|
6
|
-
this.store = store;
|
|
7
|
-
this.baseUrl = baseUrl;
|
|
8
|
-
}
|
|
9
|
-
readStore() {
|
|
10
|
-
return this.store;
|
|
11
|
-
}
|
|
12
|
-
async has({ name }) {
|
|
13
|
-
const store = this.readStore();
|
|
14
|
-
const mapping = store.find((mapping) => mapping.
|
|
15
|
-
return !!mapping;
|
|
16
|
-
}
|
|
17
|
-
async resolve({ name }) {
|
|
18
|
-
const store = this.readStore();
|
|
19
|
-
const mapping = store.find((mapping) => mapping.
|
|
20
|
-
if (!mapping) {
|
|
21
|
-
throw new Error(`Cannot find static file mapping for ${name}`);
|
|
22
|
-
}
|
|
23
|
-
return `${this.baseUrl}${mapping.generatedName}`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.StaticFileMapperRun = StaticFileMapperRun;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StaticFileMapperRun = void 0;
|
|
4
|
+
class StaticFileMapperRun {
|
|
5
|
+
constructor({ store, baseUrl }) {
|
|
6
|
+
this.store = store;
|
|
7
|
+
this.baseUrl = baseUrl;
|
|
8
|
+
}
|
|
9
|
+
readStore() {
|
|
10
|
+
return this.store;
|
|
11
|
+
}
|
|
12
|
+
async has({ name }) {
|
|
13
|
+
const store = this.readStore();
|
|
14
|
+
const mapping = store.find((mapping) => mapping.names.find((el) => el === name));
|
|
15
|
+
return !!mapping;
|
|
16
|
+
}
|
|
17
|
+
async resolve({ name }) {
|
|
18
|
+
const store = this.readStore();
|
|
19
|
+
const mapping = store.find((mapping) => mapping.names.find((el) => el === name));
|
|
20
|
+
if (!mapping) {
|
|
21
|
+
throw new Error(`Cannot find static file mapping for ${name}`);
|
|
22
|
+
}
|
|
23
|
+
return `${this.baseUrl}${mapping.generatedName}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.StaticFileMapperRun = StaticFileMapperRun;
|
|
27
27
|
//# sourceMappingURL=staticFileMapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticFileMapper.js","sourceRoot":"","sources":["../../src/staticFileMapper.ts"],"names":[],"mappings":";;;AAeA,MAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"staticFileMapper.js","sourceRoot":"","sources":["../../src/staticFileMapper.ts"],"names":[],"mappings":";;;AAeA,MAAa,mBAAmB;IA8B9B,YAAY,EAAE,KAAK,EAAE,OAAO,EAA4C;QACtE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IA7BO,SAAS;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAoB;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAE/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACrC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,CACxC,CAAC;QAEF,OAAO,CAAC,CAAC,OAAO,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAoB;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAE/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACrC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,CACxC,CAAC;QACF,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,EAAE,CAAC,CAAC;SAChE;QACD,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IACnD,CAAC;CAMF;AAlCD,kDAkCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "static-file-mapper",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Helps tracking path to generated static files for deployment bundles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\""
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@goldstack/utils-git": "0.2.
|
|
34
|
+
"@goldstack/utils-git": "0.2.2",
|
|
35
35
|
"@types/aws-lambda": "^8.10.88",
|
|
36
|
-
"@types/jest": "^
|
|
36
|
+
"@types/jest": "^29.0.1",
|
|
37
37
|
"@types/node": "^18.7.13",
|
|
38
38
|
"jest": "^28.1.0",
|
|
39
39
|
"rimraf": "^3.0.2",
|