@fastly/compute-js-static-publish 2.3.0 → 2.4.0-alpha.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/build/build-static.d.ts.map +1 -1
- package/build/build-static.js +14 -2
- package/build/init-app.js +5 -5
- package/build/types.d.ts +1 -2
- package/build/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/resources/webpack.config.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-static.d.ts","sourceRoot":"","sources":["../src/build-static.ts"],"names":[],"mappings":"AAcA,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":"AAcA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAchD,wBAAsB,iBAAiB,CAAC,iBAAiB,EAAE,eAAe,CAAC,kBAAkB,iBAoO5F"}
|
package/build/build-static.js
CHANGED
|
@@ -110,7 +110,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
110
110
|
});
|
|
111
111
|
const moduleTest = config.moduleTest;
|
|
112
112
|
const knownAssets = {};
|
|
113
|
-
let fileContents = '
|
|
113
|
+
let fileContents = '';
|
|
114
114
|
for (const [index, file] of files.entries()) {
|
|
115
115
|
const relativeFilePath = path.relative('./src', file);
|
|
116
116
|
const contentDef = defaultContentTypes.testFileContentType(finalContentTypes, file);
|
|
@@ -133,6 +133,18 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
133
133
|
knownAssets[filePath] = { contentType: type, isStatic, loadModule, };
|
|
134
134
|
}
|
|
135
135
|
fileContents += 'import { StaticAssets } from "@fastly/compute-js-static-publish";\n';
|
|
136
|
+
fileContents += `
|
|
137
|
+
function fromBase64(data) {
|
|
138
|
+
const raw = atob(data);
|
|
139
|
+
const rawLength = raw.length;
|
|
140
|
+
const array = new ArrayBuffer(rawLength);
|
|
141
|
+
const view = new Uint8Array(array);
|
|
142
|
+
for (let i = 0; i < rawLength; i++) {
|
|
143
|
+
view[i] = raw.charCodeAt(i);
|
|
144
|
+
}
|
|
145
|
+
return array;
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
136
148
|
fileContents += `\nexport const assets = {\n`;
|
|
137
149
|
for (const [index, file] of files.entries()) {
|
|
138
150
|
const contentDef = defaultContentTypes.testFileContentType(finalContentTypes, file);
|
|
@@ -148,7 +160,7 @@ export async function buildStaticLoader(commandLineValues) {
|
|
|
148
160
|
}
|
|
149
161
|
let content;
|
|
150
162
|
if (contentDef == null || contentDef.binary) {
|
|
151
|
-
content = '
|
|
163
|
+
content = 'fromBase64(file' + index + ')';
|
|
152
164
|
}
|
|
153
165
|
else {
|
|
154
166
|
content = 'String(file' + index + ')';
|
package/build/init-app.js
CHANGED
|
@@ -173,11 +173,11 @@ export function initApp(commandLineValues) {
|
|
|
173
173
|
"author": ${JSON.stringify(author)},
|
|
174
174
|
"devDependencies": {
|
|
175
175
|
"@fastly/expressly": "^1.0.0-alpha.7",
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"
|
|
176
|
+
"webpack": "^5.75.0",
|
|
177
|
+
"webpack-cli": "^5.0.0"
|
|
178
|
+
},
|
|
179
|
+
"dependencies": {
|
|
180
|
+
"@fastly/js-compute": "^0.5.12"
|
|
181
181
|
},
|
|
182
182
|
"engines": {
|
|
183
183
|
"node": ">=16.0.0"
|
package/build/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
declare type TestFn = (name: string) => boolean;
|
|
3
2
|
export declare type ContentTypeDef = {
|
|
4
3
|
test: RegExp | TestFn;
|
|
@@ -15,7 +14,7 @@ export declare type DefaultContentTypesModule = {
|
|
|
15
14
|
};
|
|
16
15
|
export declare type Asset = {
|
|
17
16
|
contentType: string;
|
|
18
|
-
content:
|
|
17
|
+
content: ArrayBuffer | string;
|
|
19
18
|
module: unknown | null;
|
|
20
19
|
isStatic: boolean;
|
|
21
20
|
};
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
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,KAAK,GAAG;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;CAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastly/compute-js-static-publish",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0-alpha.0",
|
|
5
5
|
"description": "Static Publisher for Compute@Edge JavaScript",
|
|
6
6
|
"main": "./build/index.js",
|
|
7
7
|
"types": "./build/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/fastly/compute-js-static-publish#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@fastly/js-compute": "^0.5.
|
|
33
|
+
"@fastly/js-compute": "^0.5.12",
|
|
34
34
|
"command-line-args": "^5.2.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -49,13 +49,5 @@ module.exports = {
|
|
|
49
49
|
// Polyfills go here.
|
|
50
50
|
// Used for, e.g., any cross-platform WHATWG,
|
|
51
51
|
// or core nodejs modules needed for your application.
|
|
52
|
-
new ProvidePlugin({
|
|
53
|
-
Buffer: [ "buffer", "Buffer" ],
|
|
54
|
-
}),
|
|
55
52
|
],
|
|
56
|
-
resolve: {
|
|
57
|
-
fallback: {
|
|
58
|
-
"buffer": require.resolve("buffer/"),
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
53
|
};
|