@netlify/edge-bundler 9.2.0 → 9.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.
@@ -116,7 +116,10 @@ test('Prints a nice error message when user tries importing an npm module and np
116
116
  },
117
117
  ];
118
118
  try {
119
- await bundle([sourceDirectory], distPath, declarations, { basePath });
119
+ await bundle([sourceDirectory], distPath, declarations, {
120
+ basePath,
121
+ importMapPaths: [join(basePath, 'import_map.json')],
122
+ });
120
123
  }
121
124
  catch (error) {
122
125
  expect(error).toBeInstanceOf(BundleError);
@@ -37,6 +37,9 @@ export const getDependencyTrackerPlugin = (specifiers, importMap, baseURL) => ({
37
37
  // If it does, the resolved import is the specifier we'll evaluate going
38
38
  // forward.
39
39
  if (matched) {
40
+ if (resolvedImport.protocol !== 'file:') {
41
+ return { external: true };
42
+ }
40
43
  specifier = fileURLToPath(resolvedImport).replace(/\\/g, '/');
41
44
  result.path = specifier;
42
45
  }
@@ -95,11 +98,11 @@ export const vendorNPMSpecifiers = async ({ basePath, directory, functions, impo
95
98
  // loaded as npm dependencies, because they either use the `npm:` prefix or
96
99
  // they are bare specifiers. We'll collect them in `specifiers`.
97
100
  try {
98
- await build({
101
+ const { errors, warnings } = await build({
99
102
  banner,
100
103
  bundle: true,
101
104
  entryPoints: functions,
102
- logLevel: 'error',
105
+ logLevel: 'silent',
103
106
  nodePaths,
104
107
  outdir: temporaryDirectory.path,
105
108
  platform: 'node',
@@ -107,10 +110,16 @@ export const vendorNPMSpecifiers = async ({ basePath, directory, functions, impo
107
110
  write: false,
108
111
  format: 'esm',
109
112
  });
113
+ if (errors.length !== 0) {
114
+ logger.system('ESBuild errored while tracking dependencies in edge function:', errors);
115
+ }
116
+ if (warnings.length !== 0) {
117
+ logger.system('ESBuild warned while tracking dependencies in edge function:', warnings);
118
+ }
110
119
  }
111
120
  catch (error) {
112
121
  logger.system('Could not track dependencies in edge function:', error);
113
- logger.user('An error occurred when trying to scan your edge functions for npm modules, which is an experimental feature. If you are loading npm modules, please share the errors above in https://ntl.fyi/edge-functions-npm. If you are not loading npm modules, you can ignore this message.');
122
+ logger.user('An error occurred when trying to scan your edge functions for npm modules, which is an experimental feature. If you are loading npm modules, please share the link to this deploy in https://ntl.fyi/edge-functions-npm. If you are not loading npm modules, you can ignore this message.');
114
123
  }
115
124
  // If we found no specifiers, there's nothing left to do here.
116
125
  if (specifiers.size === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "9.2.0",
3
+ "version": "9.2.1",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.js",