vike 0.4.184-commit-1f36bd8 → 0.4.184-commit-44e218c

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.
@@ -34,7 +34,22 @@ function distFileNames() {
34
34
  // - It's needed for getHash() of fixServerAssets()
35
35
  // - Asset URLs should always contain a hash: it's paramount for caching assets.
36
36
  // - If rollupOutput.assetFileNames is a function then use a wrapper function to apply the assertUsage()
37
- (0, utils_js_1.assertUsage)(false, "Setting config.build.rollupOptions.output.assetFileNames is currently forbidden. (It's possible to support, thus contact a maintainer if you need this.)");
37
+ (0, utils_js_1.assertUsage)(false, "Setting Vite's configuration build.rollupOptions.output.assetFileNames is currently forbidden. Reach out if you need to use.");
38
+ }
39
+ {
40
+ const manualChunksOriginal = rollupOutput.manualChunks;
41
+ rollupOutput.manualChunks = function (id, ...args) {
42
+ if (id.endsWith('.css') && id.includes('node_modules'))
43
+ return 'vendor';
44
+ if (manualChunksOriginal) {
45
+ if ((0, utils_js_1.isCallable)(manualChunksOriginal)) {
46
+ manualChunksOriginal.call(this, id, ...args);
47
+ }
48
+ else {
49
+ (0, utils_js_1.assertUsage)(false, "The Vite's configuration build.rollupOptions.output.manualChunks must be a function. Reach out if you need to set it to another value.");
50
+ }
51
+ }
52
+ };
38
53
  }
39
54
  });
40
55
  }
@@ -16,8 +16,6 @@ require("source-map-support/register.js");
16
16
  const getFilePath_js_1 = require("../../../../shared/getFilePath.js");
17
17
  (0, utils_js_1.assertIsNotProductionRuntime)();
18
18
  const debug = (0, utils_js_1.createDebugger)('vike:pointer-imports');
19
- console.log('transpileWithEsbuild.ts', esbuild_1.version);
20
- console.log('require.resolve("vike-react/config")', require.resolve('vike-react/config'));
21
19
  async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
22
20
  const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
23
21
  const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
@@ -65,7 +63,6 @@ async function transpileFile(filePath, transformImports, userRootDir) {
65
63
  return code;
66
64
  }
67
65
  async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
68
- console.log('transpileWithEsbuild()');
69
66
  const entryFilePath = filePath.filePathAbsoluteFilesystem;
70
67
  const entryFileDir = path_1.default.posix.dirname(entryFilePath);
71
68
  const options = {
@@ -101,16 +98,13 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
101
98
  build.onResolve({ filter: /.*/ }, async (args) => {
102
99
  if (args.kind !== 'import-statement')
103
100
  return;
104
- console.log('onResolve()', args);
105
101
  // Avoid infinite loop: https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
106
102
  const useEsbuildResolver = 'useEsbuildResolver';
107
103
  if (args.pluginData?.[useEsbuildResolver])
108
104
  return;
109
105
  const { path, ...opts } = args;
110
106
  opts.pluginData = { [useEsbuildResolver]: true };
111
- console.log('build.resolve()', path, opts);
112
107
  const resolved = await build.resolve(path, opts);
113
- console.log('build.resolve() done');
114
108
  if (resolved.errors.length > 0) {
115
109
  /* 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 file which isn't that nice, whereas esbuild refers to the source +config.ts file.
116
110
  pointerImports[args.path] = false
@@ -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.184-commit-1f36bd8';
5
+ exports.PROJECT_VERSION = '0.4.184-commit-44e218c';
@@ -129,17 +129,15 @@ function parseHost(host, url) {
129
129
  const ret = { hostname: null, port: null };
130
130
  if (!host)
131
131
  return ret;
132
- // hostname
133
- const [hostname, ...rest] = host.split(':');
134
- ret.hostname = hostname;
135
132
  // port
136
- if (rest.length > 0) {
137
- (0, assert_js_1.assert)(rest.length === 1, url);
138
- const portStr = rest[0];
139
- const port = parseInt(portStr, 10);
133
+ const parts = host.split(':');
134
+ if (parts.length > 1) {
135
+ const port = parseInt(parts.pop(), 10);
140
136
  (0, assert_js_1.assert)(port || port === 0, url);
141
137
  ret.port = port;
142
138
  }
139
+ // hostname
140
+ ret.hostname = parts.join(':');
143
141
  return ret;
144
142
  }
145
143
  function parseProtocol(uri) {
@@ -2,7 +2,7 @@ export { distFileNames };
2
2
  // Attempt to preserve file structure of `.page.js` files:
3
3
  // - https://github.com/vikejs/vike/commit/11a4c49e5403aa7c37c8020c462b499425b41854
4
4
  // - Blocker: https://github.com/rollup/rollup/issues/4724
5
- import { assertPosixPath, assert, assertUsage, isArray } from '../utils.js';
5
+ import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '../utils.js';
6
6
  import path from 'path';
7
7
  import { getAssetsDir } from '../shared/getAssetsDir.js';
8
8
  function distFileNames() {
@@ -29,7 +29,22 @@ function distFileNames() {
29
29
  // - It's needed for getHash() of fixServerAssets()
30
30
  // - Asset URLs should always contain a hash: it's paramount for caching assets.
31
31
  // - If rollupOutput.assetFileNames is a function then use a wrapper function to apply the assertUsage()
32
- assertUsage(false, "Setting config.build.rollupOptions.output.assetFileNames is currently forbidden. (It's possible to support, thus contact a maintainer if you need this.)");
32
+ assertUsage(false, "Setting Vite's configuration build.rollupOptions.output.assetFileNames is currently forbidden. Reach out if you need to use.");
33
+ }
34
+ {
35
+ const manualChunksOriginal = rollupOutput.manualChunks;
36
+ rollupOutput.manualChunks = function (id, ...args) {
37
+ if (id.endsWith('.css') && id.includes('node_modules'))
38
+ return 'vendor';
39
+ if (manualChunksOriginal) {
40
+ if (isCallable(manualChunksOriginal)) {
41
+ manualChunksOriginal.call(this, id, ...args);
42
+ }
43
+ else {
44
+ assertUsage(false, "The Vite's configuration build.rollupOptions.output.manualChunks must be a function. Reach out if you need to set it to another value.");
45
+ }
46
+ }
47
+ };
33
48
  }
34
49
  });
35
50
  }
@@ -2,7 +2,7 @@ export { transpileAndExecuteFile };
2
2
  export { getConfigBuildErrorFormatted };
3
3
  export { getConfigExecutionErrorIntroMsg };
4
4
  export { isTemporaryBuildFile };
5
- import { build, formatMessages, version } from 'esbuild';
5
+ import { build, formatMessages } from 'esbuild';
6
6
  import fs from 'fs';
7
7
  import path from 'path';
8
8
  import pc from '@brillout/picocolors';
@@ -14,8 +14,6 @@ import 'source-map-support/register.js';
14
14
  import { getFilePathAbsoluteUserRootDir } from '../../../../shared/getFilePath.js';
15
15
  assertIsNotProductionRuntime();
16
16
  const debug = createDebugger('vike:pointer-imports');
17
- console.log('transpileWithEsbuild.ts', version);
18
- console.log('require.resolve("vike-react/config")', require.resolve('vike-react/config'));
19
17
  async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
20
18
  const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
21
19
  const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
@@ -62,7 +60,6 @@ async function transpileFile(filePath, transformImports, userRootDir) {
62
60
  return code;
63
61
  }
64
62
  async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
65
- console.log('transpileWithEsbuild()');
66
63
  const entryFilePath = filePath.filePathAbsoluteFilesystem;
67
64
  const entryFileDir = path.posix.dirname(entryFilePath);
68
65
  const options = {
@@ -98,16 +95,13 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
98
95
  build.onResolve({ filter: /.*/ }, async (args) => {
99
96
  if (args.kind !== 'import-statement')
100
97
  return;
101
- console.log('onResolve()', args);
102
98
  // Avoid infinite loop: https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
103
99
  const useEsbuildResolver = 'useEsbuildResolver';
104
100
  if (args.pluginData?.[useEsbuildResolver])
105
101
  return;
106
102
  const { path, ...opts } = args;
107
103
  opts.pluginData = { [useEsbuildResolver]: true };
108
- console.log('build.resolve()', path, opts);
109
104
  const resolved = await build.resolve(path, opts);
110
- console.log('build.resolve() done');
111
105
  if (resolved.errors.length > 0) {
112
106
  /* 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 file which isn't that nice, whereas esbuild refers to the source +config.ts file.
113
107
  pointerImports[args.path] = false
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.184-commit-1f36bd8";
1
+ export declare const PROJECT_VERSION: "0.4.184-commit-44e218c";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.184-commit-1f36bd8';
2
+ export const PROJECT_VERSION = '0.4.184-commit-44e218c';
@@ -134,17 +134,15 @@ function parseHost(host, url) {
134
134
  const ret = { hostname: null, port: null };
135
135
  if (!host)
136
136
  return ret;
137
- // hostname
138
- const [hostname, ...rest] = host.split(':');
139
- ret.hostname = hostname;
140
137
  // port
141
- if (rest.length > 0) {
142
- assert(rest.length === 1, url);
143
- const portStr = rest[0];
144
- const port = parseInt(portStr, 10);
138
+ const parts = host.split(':');
139
+ if (parts.length > 1) {
140
+ const port = parseInt(parts.pop(), 10);
145
141
  assert(port || port === 0, url);
146
142
  ret.port = port;
147
143
  }
144
+ // hostname
145
+ ret.hostname = parts.join(':');
148
146
  return ret;
149
147
  }
150
148
  function parseProtocol(uri) {
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.184-commit-1f36bd8";
3
+ projectVersion: "0.4.184-commit-44e218c";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.184-commit-1f36bd8",
3
+ "version": "0.4.184-commit-44e218c",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -21,7 +21,7 @@
21
21
  "acorn": "^8.0.0",
22
22
  "cac": "^6.0.0",
23
23
  "es-module-lexer": "^1.0.0",
24
- "esbuild": "0.23.0",
24
+ "esbuild": "^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0",
25
25
  "fast-glob": "^3.0.0",
26
26
  "semver": "^7.0.0",
27
27
  "sirv": "^2.0.0",
@@ -217,6 +217,7 @@
217
217
  "acorn": "^8.11.2",
218
218
  "cac": "^6.7.14",
219
219
  "es-module-lexer": "^1.4.1",
220
+ "esbuild": "^0.23.0",
220
221
  "fast-glob": "^3.3.2",
221
222
  "react-streaming": "^0.3.42",
222
223
  "rimraf": "^5.0.5",