vike 0.4.249-commit-ec50591 → 0.4.249-commit-92f1383
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/node/vite/plugins/pluginReplaceConstantsPageContext.js +1 -0
- package/dist/node/vite/plugins/pluginStaticReplace/buildFilterRolldown.d.ts +1 -5
- package/dist/node/vite/plugins/pluginStaticReplace/buildFilterRolldown.js +1 -6
- package/dist/node/vite/plugins/pluginStaticReplace.js +22 -8
- package/dist/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +1 -0
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ const constantsIsClientSide = [
|
|
|
11
11
|
];
|
|
12
12
|
// - See https://vike.dev/pageContext#narrowing-down
|
|
13
13
|
// - We cannot use [`define`](https://vite.dev/config/shared-options.html#define) because of https://github.com/rolldown/rolldown/issues/4300
|
|
14
|
+
// filterRolldown
|
|
14
15
|
const skipNodeModules = '/node_modules/';
|
|
15
16
|
const skipIrrelevant = 'Context.isClientSide';
|
|
16
17
|
assert(constantsIsClientSide.every((constant) => constant.endsWith(skipIrrelevant)));
|
|
@@ -6,8 +6,4 @@ import type { StaticReplace } from './applyStaticReplace.js';
|
|
|
6
6
|
* except for call.match.function array which is OR logic.
|
|
7
7
|
* Between staticReplace entries it's OR logic.
|
|
8
8
|
*/
|
|
9
|
-
declare function buildFilterRolldown(staticReplaceList: StaticReplace[]):
|
|
10
|
-
code: {
|
|
11
|
-
include: RegExp;
|
|
12
|
-
};
|
|
13
|
-
} | null;
|
|
9
|
+
declare function buildFilterRolldown(staticReplaceList: StaticReplace[]): RegExp | null;
|
|
@@ -61,12 +61,7 @@ function buildFilterRolldown(staticReplaceList) {
|
|
|
61
61
|
if (rulePatterns.length === 0)
|
|
62
62
|
return null;
|
|
63
63
|
// Create a regex that matches if any rule pattern matches (OR between staticReplace entries)
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
code: {
|
|
67
|
-
include: regex,
|
|
68
|
-
},
|
|
69
|
-
};
|
|
64
|
+
return new RegExp(rulePatterns.join('|'), 's');
|
|
70
65
|
}
|
|
71
66
|
/**
|
|
72
67
|
* Extract import strings from function patterns
|
|
@@ -5,11 +5,29 @@ import { applyStaticReplace } from './pluginStaticReplace/applyStaticReplace.js'
|
|
|
5
5
|
import { buildFilterRolldown } from './pluginStaticReplace/buildFilterRolldown.js';
|
|
6
6
|
function pluginStaticReplace(vikeConfig) {
|
|
7
7
|
let config;
|
|
8
|
+
// staticReplaceList
|
|
8
9
|
const staticReplaceList = getStaticReplaceList(vikeConfig);
|
|
9
10
|
if (staticReplaceList.length === 0)
|
|
10
11
|
return [];
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
// filterRolldown
|
|
13
|
+
const skipNodeModules = '/node_modules/';
|
|
14
|
+
const include = buildFilterRolldown(staticReplaceList);
|
|
15
|
+
assert(include);
|
|
16
|
+
const filterRolldown = {
|
|
17
|
+
id: {
|
|
18
|
+
exclude: `**${skipNodeModules}**`,
|
|
19
|
+
},
|
|
20
|
+
code: {
|
|
21
|
+
include,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const filterFunction = (id, code) => {
|
|
25
|
+
if (id.includes(skipNodeModules))
|
|
26
|
+
return false;
|
|
27
|
+
if (!include.test(code))
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
13
31
|
return [
|
|
14
32
|
{
|
|
15
33
|
name: 'vike:pluginStaticReplace',
|
|
@@ -20,13 +38,9 @@ function pluginStaticReplace(vikeConfig) {
|
|
|
20
38
|
},
|
|
21
39
|
},
|
|
22
40
|
transform: {
|
|
23
|
-
filter:
|
|
24
|
-
code: {
|
|
25
|
-
include: filterRolldown.code.include,
|
|
26
|
-
exclude: /node_modules/,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
41
|
+
filter: filterRolldown,
|
|
29
42
|
async handler(code, id, options) {
|
|
43
|
+
assert(filterFunction(id, code));
|
|
30
44
|
const env = isViteServerSide_extraSafe(config, this.environment, options) ? 'server' : 'client';
|
|
31
45
|
const result = await applyStaticReplace({
|
|
32
46
|
code,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.249-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.249-commit-92f1383";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.249-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.249-commit-92f1383';
|