@fastly/compute-js-static-publish 3.1.0 → 3.2.1
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/build/build-static.d.ts.map +1 -1
- package/build/build-static.js +6 -8
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/types.d.ts +11 -3
- package/build/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/resources/statics.d.ts +2 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-static.d.ts","sourceRoot":"","sources":["../src/build-static.ts"],"names":[],"mappings":"AAkBA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAchD,wBAAsB,iBAAiB,CAAC,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"build-static.d.ts","sourceRoot":"","sources":["../src/build-static.ts"],"names":[],"mappings":"AAkBA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAchD,wBAAsB,iBAAiB,CAAC,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,iBAmP5F"}
|
package/build/build-static.js
CHANGED
|
@@ -151,22 +151,20 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
// Serve static files by copying them into the static content dir and using includeBytes()
|
|
154
|
-
let staticFileExt,
|
|
154
|
+
let staticFileExt, staticFileType;
|
|
155
155
|
if (contentDef == null || contentDef.binary) {
|
|
156
156
|
staticFileExt = '.bin';
|
|
157
|
-
|
|
158
|
-
isBinary = true;
|
|
157
|
+
staticFileType = 'binary';
|
|
159
158
|
}
|
|
160
159
|
else {
|
|
161
160
|
staticFileExt = '.txt';
|
|
162
|
-
|
|
163
|
-
isBinary = false;
|
|
161
|
+
staticFileType = 'string';
|
|
164
162
|
}
|
|
165
163
|
const staticFilePath = `${staticContentDir}/file${index}${staticFileExt}`;
|
|
166
164
|
fs.cpSync(file, staticFilePath);
|
|
167
|
-
console.log(`✔️ Copied static ${
|
|
165
|
+
console.log(`✔️ Copied static ${staticFileType} file "${file}" to "${staticFilePath}".`);
|
|
168
166
|
let content = `includeBytes("${staticFilePath}")`;
|
|
169
|
-
if (
|
|
167
|
+
if (staticFileType === 'string') {
|
|
170
168
|
content = `textDecoder.decode(${content})`;
|
|
171
169
|
}
|
|
172
170
|
let module;
|
|
@@ -176,7 +174,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
176
174
|
else {
|
|
177
175
|
module = 'null';
|
|
178
176
|
}
|
|
179
|
-
fileContents += ` ${JSON.stringify(filePath)}: { contentType: ${JSON.stringify(type)}, content: ${content}, module: ${module}, isStatic: ${JSON.stringify(isStatic)} },\n`;
|
|
177
|
+
fileContents += ` ${JSON.stringify(filePath)}: { type: ${JSON.stringify(staticFileType)}, contentType: ${JSON.stringify(type)}, content: ${content}, module: ${module}, isStatic: ${JSON.stringify(isStatic)} },\n`;
|
|
180
178
|
}
|
|
181
179
|
fileContents += '};\n';
|
|
182
180
|
let spaFile = (_h = config.spa) !== null && _h !== void 0 ? _h : false;
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
package/build/types.d.ts
CHANGED
|
@@ -12,12 +12,20 @@ export declare type DefaultContentTypesModule = {
|
|
|
12
12
|
mergeContentTypes: (contentTypes: ContentTypeDef[]) => ContentTypeDef[];
|
|
13
13
|
testFileContentType: (contentTypes: ContentTypeDef[], file: string) => ContentTypeMatch;
|
|
14
14
|
};
|
|
15
|
-
export declare type
|
|
15
|
+
export declare type AssetBase = {
|
|
16
16
|
contentType: string;
|
|
17
|
-
|
|
18
|
-
module: unknown | null;
|
|
17
|
+
module: any | null;
|
|
19
18
|
isStatic: boolean;
|
|
20
19
|
};
|
|
20
|
+
export declare type StringAsset = AssetBase & {
|
|
21
|
+
type: 'string';
|
|
22
|
+
content: string;
|
|
23
|
+
};
|
|
24
|
+
export declare type BinaryAsset = AssetBase & {
|
|
25
|
+
type: 'binary';
|
|
26
|
+
content: Uint8Array;
|
|
27
|
+
};
|
|
28
|
+
export declare type Asset = StringAsset | BinaryAsset;
|
|
21
29
|
export declare type AssetsMap = {
|
|
22
30
|
[filePath: string]: Asset;
|
|
23
31
|
};
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,aAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAExC,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,oBAAY,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAC;IACxE,mBAAmB,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,gBAAgB,CAAC;CACzF,CAAC;AAEF,oBAAY,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["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AM,EAAG,GAAG,IAAI,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IAChD,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;CACxC,CAAC"}
|
package/package.json
CHANGED
package/resources/statics.d.ts
CHANGED
|
@@ -2,22 +2,8 @@
|
|
|
2
2
|
* Generated by @fastly/compute-js-static-publish.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
module: any | null,
|
|
8
|
-
isStatic: boolean,
|
|
9
|
-
};
|
|
10
|
-
type StringAsset = AssetBase & {
|
|
11
|
-
type: 'string',
|
|
12
|
-
content: string,
|
|
13
|
-
};
|
|
14
|
-
type BinaryAsset = AssetBase & {
|
|
15
|
-
type: 'binary',
|
|
16
|
-
content: Uint8Array,
|
|
17
|
-
};
|
|
18
|
-
type Asset = StringAsset | BinaryAsset;
|
|
19
|
-
import { StaticAssets } from "@fastly/compute-js-static-publish";
|
|
20
|
-
export declare const assets: Record<string, Asset>;
|
|
5
|
+
import type { AssetsMap, StaticAssets } from "@fastly/compute-js-static-publish";
|
|
6
|
+
export declare const assets: AssetsMap;
|
|
21
7
|
export declare const spaFile: string | false;
|
|
22
8
|
export declare const notFoundPageFile: string | false;
|
|
23
9
|
export declare const autoIndex: string[] | false;
|