@fastly/compute-js-static-publish 2.3.0-alpha.4 → 2.3.0-alpha.5

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.
@@ -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,iBAwN5F"}
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,iBAuN5F"}
@@ -21,7 +21,7 @@ function getFiles(results, dir) {
21
21
  }
22
22
  }
23
23
  export async function buildStaticLoader(commandLineValues) {
24
- var _a, _b, _c, _d, _e, _f, _g, _h;
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
25
25
  const { 'suppress-framework-warnings': suppressFrameworkWarnings } = commandLineValues;
26
26
  const displayFrameworkWarnings = !suppressFrameworkWarnings;
27
27
  console.log("🚀 Building loader...");
@@ -37,12 +37,12 @@ export async function buildStaticLoader(commandLineValues) {
37
37
  process.exitCode = 1;
38
38
  return;
39
39
  }
40
- const results = [];
41
- getFiles(results, config.publicDir);
42
40
  const outputDir = path.resolve();
43
- const publicDirRoot = path.resolve(config.publicDir);
41
+ const publicDirRoot = path.resolve((_a = config.publicDir) !== null && _a !== void 0 ? _a : './');
42
+ const results = [];
43
+ getFiles(results, publicDirRoot);
44
44
  console.log(`✔️ Public directory '${publicDirRoot}'.`);
45
- const staticDirs = (_a = config.staticDirs) !== null && _a !== void 0 ? _a : [];
45
+ const staticDirs = (_b = config.staticDirs) !== null && _b !== void 0 ? _b : [];
46
46
  if (staticDirs.length > 0) {
47
47
  console.log(`✔️ Using static directories: ${staticDirs.join(', ')}`);
48
48
  }
@@ -51,11 +51,11 @@ export async function buildStaticLoader(commandLineValues) {
51
51
  console.log(`✔️ No static directories defined.`);
52
52
  }
53
53
  }
54
- const staticRoots = staticDirs.map(dir => path.resolve(config.publicDir, dir));
54
+ const staticRoots = staticDirs.map(dir => path.resolve(publicDirRoot, dir));
55
55
  const DEFAULT_EXCLUDE_DIRS = [
56
56
  './node_modules'
57
57
  ];
58
- const excludeDirs = (_b = config.excludeDirs) !== null && _b !== void 0 ? _b : DEFAULT_EXCLUDE_DIRS;
58
+ const excludeDirs = (_c = config.excludeDirs) !== null && _c !== void 0 ? _c : DEFAULT_EXCLUDE_DIRS;
59
59
  if (excludeDirs.length > 0) {
60
60
  console.log(`✔️ Using exclude directories: ${excludeDirs.join(', ')}`);
61
61
  }
@@ -64,17 +64,17 @@ export async function buildStaticLoader(commandLineValues) {
64
64
  console.log(`✔️ No exclude directories defined.`);
65
65
  }
66
66
  }
67
- const excludeRoots = excludeDirs.map(dir => path.resolve(config.publicDir, dir));
67
+ const excludeRoots = excludeDirs.map(dir => path.resolve(publicDirRoot, dir));
68
68
  // Load defaultContentTypes module
69
69
  const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
70
70
  const defaultContentTypesJsSrcPath = path.resolve(__dirname, '../resources/default-content-types.cjs');
71
71
  const defaultContentTypes = await import(defaultContentTypesJsSrcPath);
72
72
  // Load content types
73
- const finalContentTypes = defaultContentTypes.mergeContentTypes((_c = config.contentTypes) !== null && _c !== void 0 ? _c : []);
73
+ const finalContentTypes = defaultContentTypes.mergeContentTypes((_d = config.contentTypes) !== null && _d !== void 0 ? _d : []);
74
74
  const DEFAULT_INCLUDE_DIRS = [
75
75
  './.well-known'
76
76
  ];
77
- const includeDirs = (_d = config.includeDirs) !== null && _d !== void 0 ? _d : DEFAULT_INCLUDE_DIRS;
77
+ const includeDirs = (_e = config.includeDirs) !== null && _e !== void 0 ? _e : DEFAULT_INCLUDE_DIRS;
78
78
  if (includeDirs.length > 0) {
79
79
  console.log(`✔️ Using include directories: ${includeDirs.join(', ')}`);
80
80
  }
@@ -83,12 +83,12 @@ export async function buildStaticLoader(commandLineValues) {
83
83
  console.log(`✔️ No include directories defined.`);
84
84
  }
85
85
  }
86
- const includeRoots = includeDirs.map(dir => path.resolve(config.publicDir, dir));
86
+ const includeRoots = includeDirs.map(dir => path.resolve(publicDirRoot, dir));
87
87
  const excludeTest = config.excludeTest;
88
88
  const files = results
89
89
  .filter(file => {
90
90
  // Exclude files that come from C@E app dir
91
- if (file.startsWith(outputDir)) {
91
+ if (outputDir != publicDirRoot && file.startsWith(outputDir)) {
92
92
  return false;
93
93
  }
94
94
  // Include files that come from "included roots" dir
@@ -163,7 +163,7 @@ export async function buildStaticLoader(commandLineValues) {
163
163
  fileContents += ` ${JSON.stringify(filePath)}: { contentType: ${JSON.stringify(type)}, content: ${content}, module: ${module}, isStatic: ${JSON.stringify(isStatic)} },\n`;
164
164
  }
165
165
  fileContents += '};\n';
166
- let spaFile = (_e = config.spa) !== null && _e !== void 0 ? _e : false;
166
+ let spaFile = (_f = config.spa) !== null && _f !== void 0 ? _f : false;
167
167
  if (spaFile) {
168
168
  console.log(`✔️ Application SPA file '${spaFile}'.`);
169
169
  if (!knownAssets[spaFile] || knownAssets[spaFile].contentType !== 'text/html') {
@@ -179,7 +179,7 @@ export async function buildStaticLoader(commandLineValues) {
179
179
  }
180
180
  }
181
181
  fileContents += `\nexport const spaFile = ${JSON.stringify(spaFile)};\n`;
182
- let notFoundPageFile = (_f = config.notFoundPage) !== null && _f !== void 0 ? _f : false;
182
+ let notFoundPageFile = (_g = config.notFoundPage) !== null && _g !== void 0 ? _g : false;
183
183
  if (notFoundPageFile) {
184
184
  console.log(`✔️ Application 'not found (404)' file '${notFoundPageFile}'.`);
185
185
  if (!knownAssets[notFoundPageFile] || knownAssets[notFoundPageFile].contentType !== 'text/html') {
@@ -195,9 +195,9 @@ export async function buildStaticLoader(commandLineValues) {
195
195
  }
196
196
  }
197
197
  fileContents += `\nexport const notFoundPageFile = ${JSON.stringify(notFoundPageFile)};\n`;
198
- let autoIndex = (_g = config.autoIndex) !== null && _g !== void 0 ? _g : null;
198
+ let autoIndex = (_h = config.autoIndex) !== null && _h !== void 0 ? _h : null;
199
199
  fileContents += `\nexport const autoIndex = ${JSON.stringify(autoIndex)};\n`;
200
- let autoExt = (_h = config.autoExt) !== null && _h !== void 0 ? _h : null;
200
+ let autoExt = (_j = config.autoExt) !== null && _j !== void 0 ? _j : null;
201
201
  fileContents += `\nexport const autoExt = ${JSON.stringify(autoExt)};\n`;
202
202
  fileContents += '\nexport const staticAssets = new StaticAssets(assets);\n';
203
203
  fs.writeFileSync('./src/statics.js', fileContents);
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.3.0-alpha.4",
4
+ "version": "2.3.0-alpha.5",
5
5
  "description": "Static Publisher for Compute@Edge JavaScript",
6
6
  "main": "./build/index.js",
7
7
  "types": "./build/index.d.ts",