vike 0.4.200-commit-ac84558 → 0.4.201
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/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +27 -2
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/debug.js +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +28 -3
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/debug.js +2 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
|
@@ -17,8 +17,15 @@ const transformPointerImports_js_1 = require("./transformPointerImports.js");
|
|
|
17
17
|
const getVikeConfig_js_1 = require("../getVikeConfig.js");
|
|
18
18
|
require("source-map-support/register.js");
|
|
19
19
|
const getFilePath_js_1 = require("../../../../shared/getFilePath.js");
|
|
20
|
+
const module_1 = require("module");
|
|
21
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
22
|
+
const importMetaUrl = `file://${__filename}`;
|
|
23
|
+
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
20
24
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
21
25
|
const debug = (0, utils_js_1.createDebugger)('vike:pointer-imports');
|
|
26
|
+
const debugEsbuildResolve = (0, utils_js_1.createDebugger)('vike:esbuild-resolve');
|
|
27
|
+
if (debugEsbuildResolve.isActivated)
|
|
28
|
+
debugEsbuildResolve('esbuild version', esbuild_1.version);
|
|
22
29
|
async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
|
|
23
30
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
24
31
|
const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
|
|
@@ -100,20 +107,38 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
100
107
|
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
101
108
|
if (args.kind !== 'import-statement')
|
|
102
109
|
return;
|
|
110
|
+
if (debugEsbuildResolve.isActivated)
|
|
111
|
+
debugEsbuildResolve('args', args);
|
|
103
112
|
// Avoid infinite loop: https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
|
|
104
113
|
const useEsbuildResolver = 'useEsbuildResolver';
|
|
105
114
|
if (args.pluginData?.[useEsbuildResolver])
|
|
106
115
|
return;
|
|
107
116
|
const { path, ...opts } = args;
|
|
108
117
|
opts.pluginData = { [useEsbuildResolver]: true };
|
|
109
|
-
|
|
118
|
+
let resolved = await build.resolve(path, opts);
|
|
119
|
+
if (debugEsbuildResolve.isActivated)
|
|
120
|
+
debugEsbuildResolve('resolved', resolved);
|
|
121
|
+
// Temporary workaround for https://github.com/vikejs/vike/issues/1729
|
|
122
|
+
// - Required for esbuild@0.24.0 (November 2024).
|
|
123
|
+
// - Let's try to remove this workaround after some time.
|
|
110
124
|
if (resolved.errors.length > 0) {
|
|
125
|
+
let resolvedWithNode;
|
|
126
|
+
try {
|
|
127
|
+
resolvedWithNode = require_.resolve(path, { paths: [args.resolveDir] });
|
|
128
|
+
}
|
|
129
|
+
catch { }
|
|
130
|
+
if (debugEsbuildResolve.isActivated)
|
|
131
|
+
debugEsbuildResolve('resolvedWithNode', resolvedWithNode);
|
|
132
|
+
if (resolvedWithNode)
|
|
133
|
+
resolved = { path: resolvedWithNode };
|
|
134
|
+
}
|
|
135
|
+
if (resolved.errors && resolved.errors.length > 0) {
|
|
111
136
|
/* 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.
|
|
112
137
|
pointerImports[args.path] = false
|
|
113
138
|
return { external: true }
|
|
114
139
|
*/
|
|
115
|
-
cleanEsbuildErrors(resolved.errors);
|
|
116
140
|
// Let esbuild throw the error
|
|
141
|
+
cleanEsbuildErrors(resolved.errors);
|
|
117
142
|
return resolved;
|
|
118
143
|
}
|
|
119
144
|
(0, utils_js_1.assert)(resolved.path);
|
package/dist/cjs/utils/debug.js
CHANGED
|
@@ -2,7 +2,7 @@ export { transpileAndExecuteFile };
|
|
|
2
2
|
export { getConfigBuildErrorFormatted };
|
|
3
3
|
export { getConfigExecutionErrorIntroMsg };
|
|
4
4
|
export { isTemporaryBuildFile };
|
|
5
|
-
import { build, formatMessages } from 'esbuild';
|
|
5
|
+
import { build, formatMessages, version } from 'esbuild';
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import pc from '@brillout/picocolors';
|
|
@@ -12,8 +12,15 @@ import { transformPointerImports } from './transformPointerImports.js';
|
|
|
12
12
|
import { vikeConfigDependencies } from '../getVikeConfig.js';
|
|
13
13
|
import 'source-map-support/register.js';
|
|
14
14
|
import { getFilePathAbsoluteUserRootDir } from '../../../../shared/getFilePath.js';
|
|
15
|
+
import { createRequire } from 'module';
|
|
16
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
17
|
+
const importMetaUrl = import.meta.url;
|
|
18
|
+
const require_ = createRequire(importMetaUrl);
|
|
15
19
|
assertIsNotProductionRuntime();
|
|
16
20
|
const debug = createDebugger('vike:pointer-imports');
|
|
21
|
+
const debugEsbuildResolve = createDebugger('vike:esbuild-resolve');
|
|
22
|
+
if (debugEsbuildResolve.isActivated)
|
|
23
|
+
debugEsbuildResolve('esbuild version', version);
|
|
17
24
|
async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
|
|
18
25
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
19
26
|
const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
|
|
@@ -95,20 +102,38 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
95
102
|
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
96
103
|
if (args.kind !== 'import-statement')
|
|
97
104
|
return;
|
|
105
|
+
if (debugEsbuildResolve.isActivated)
|
|
106
|
+
debugEsbuildResolve('args', args);
|
|
98
107
|
// Avoid infinite loop: https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
|
|
99
108
|
const useEsbuildResolver = 'useEsbuildResolver';
|
|
100
109
|
if (args.pluginData?.[useEsbuildResolver])
|
|
101
110
|
return;
|
|
102
111
|
const { path, ...opts } = args;
|
|
103
112
|
opts.pluginData = { [useEsbuildResolver]: true };
|
|
104
|
-
|
|
113
|
+
let resolved = await build.resolve(path, opts);
|
|
114
|
+
if (debugEsbuildResolve.isActivated)
|
|
115
|
+
debugEsbuildResolve('resolved', resolved);
|
|
116
|
+
// Temporary workaround for https://github.com/vikejs/vike/issues/1729
|
|
117
|
+
// - Required for esbuild@0.24.0 (November 2024).
|
|
118
|
+
// - Let's try to remove this workaround after some time.
|
|
105
119
|
if (resolved.errors.length > 0) {
|
|
120
|
+
let resolvedWithNode;
|
|
121
|
+
try {
|
|
122
|
+
resolvedWithNode = require_.resolve(path, { paths: [args.resolveDir] });
|
|
123
|
+
}
|
|
124
|
+
catch { }
|
|
125
|
+
if (debugEsbuildResolve.isActivated)
|
|
126
|
+
debugEsbuildResolve('resolvedWithNode', resolvedWithNode);
|
|
127
|
+
if (resolvedWithNode)
|
|
128
|
+
resolved = { path: resolvedWithNode };
|
|
129
|
+
}
|
|
130
|
+
if (resolved.errors && resolved.errors.length > 0) {
|
|
106
131
|
/* 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.
|
|
107
132
|
pointerImports[args.path] = false
|
|
108
133
|
return { external: true }
|
|
109
134
|
*/
|
|
110
|
-
cleanEsbuildErrors(resolved.errors);
|
|
111
135
|
// Let esbuild throw the error
|
|
136
|
+
cleanEsbuildErrors(resolved.errors);
|
|
112
137
|
return resolved;
|
|
113
138
|
}
|
|
114
139
|
assert(resolved.path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.201";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.201';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createDebugger };
|
|
2
2
|
export { isDebugActivated };
|
|
3
3
|
export type { Debug };
|
|
4
|
-
declare const flags: readonly ["vike:error", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files"];
|
|
4
|
+
declare const flags: readonly ["vike:error", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files", "vike:esbuild-resolve"];
|
|
5
5
|
type Flag = (typeof flags)[number];
|
|
6
6
|
type Debug = ReturnType<typeof createDebugger>;
|
|
7
7
|
type Options = {
|
package/dist/esm/utils/debug.js
CHANGED