vike 0.4.200-commit-a317fa3 → 0.4.200-commit-de0e6ef

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.
@@ -100,7 +100,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
100
100
  setup(build) {
101
101
  // https://github.com/brillout/esbuild-playground
102
102
  build.onResolve({ filter: /.*/ }, async (args) => {
103
- console.log('onResolve()', args);
103
+ console.log('onResolve()', JSON.stringify(args, null, 2));
104
104
  if (args.kind !== 'import-statement')
105
105
  return;
106
106
  // Avoid infinite loop: https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
@@ -109,15 +109,23 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
109
109
  return;
110
110
  const { path, ...opts } = args;
111
111
  opts.pluginData = { [useEsbuildResolver]: true };
112
- const resolved = await build.resolve(path, opts);
113
- console.log('resolved', resolved);
112
+ let resolved = await build.resolve(path, opts);
114
113
  if (resolved.errors.length > 0) {
114
+ let resolvedWithNode;
115
+ try {
116
+ resolvedWithNode = require.resolve(args.path, { paths: [args.resolveDir] });
117
+ }
118
+ catch { }
119
+ if (resolvedWithNode)
120
+ resolved = { path: resolvedWithNode };
121
+ }
122
+ if (resolved.errors && resolved.errors.length > 0) {
115
123
  /* We could do the following to let Node.js throw the error, but we don't because the error shown by esbuild is prettier: the Node.js error refers to the transpiled [build-f7i251e0iwnw]+config.ts.mjs whereas esbuild refers to the source +config.ts file.
116
124
  pointerImports[args.path] = false
117
125
  return { external: true }
118
126
  */
119
- cleanEsbuildErrors(resolved.errors);
120
127
  // Let esbuild throw the error
128
+ cleanEsbuildErrors(resolved.errors);
121
129
  return resolved;
122
130
  }
123
131
  (0, utils_js_1.assert)(resolved.path);
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.200-commit-a317fa3';
5
+ exports.PROJECT_VERSION = '0.4.200-commit-de0e6ef';
@@ -95,7 +95,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
95
95
  setup(build) {
96
96
  // https://github.com/brillout/esbuild-playground
97
97
  build.onResolve({ filter: /.*/ }, async (args) => {
98
- console.log('onResolve()', args);
98
+ console.log('onResolve()', JSON.stringify(args, null, 2));
99
99
  if (args.kind !== 'import-statement')
100
100
  return;
101
101
  // Avoid infinite loop: https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
@@ -104,15 +104,23 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
104
104
  return;
105
105
  const { path, ...opts } = args;
106
106
  opts.pluginData = { [useEsbuildResolver]: true };
107
- const resolved = await build.resolve(path, opts);
108
- console.log('resolved', resolved);
107
+ let resolved = await build.resolve(path, opts);
109
108
  if (resolved.errors.length > 0) {
109
+ let resolvedWithNode;
110
+ try {
111
+ resolvedWithNode = require.resolve(args.path, { paths: [args.resolveDir] });
112
+ }
113
+ catch { }
114
+ if (resolvedWithNode)
115
+ resolved = { path: resolvedWithNode };
116
+ }
117
+ if (resolved.errors && resolved.errors.length > 0) {
110
118
  /* We could do the following to let Node.js throw the error, but we don't because the error shown by esbuild is prettier: the Node.js error refers to the transpiled [build-f7i251e0iwnw]+config.ts.mjs whereas esbuild refers to the source +config.ts file.
111
119
  pointerImports[args.path] = false
112
120
  return { external: true }
113
121
  */
114
- cleanEsbuildErrors(resolved.errors);
115
122
  // Let esbuild throw the error
123
+ cleanEsbuildErrors(resolved.errors);
116
124
  return resolved;
117
125
  }
118
126
  assert(resolved.path);
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.200-commit-a317fa3";
1
+ export declare const PROJECT_VERSION: "0.4.200-commit-de0e6ef";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.200-commit-a317fa3';
2
+ export const PROJECT_VERSION = '0.4.200-commit-de0e6ef';
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.200-commit-a317fa3";
3
+ projectVersion: "0.4.200-commit-de0e6ef";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.200-commit-a317fa3",
3
+ "version": "0.4.200-commit-de0e6ef",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {