vike 0.4.189 → 0.4.191
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/distFileNames.js +13 -7
- package/dist/cjs/shared/getPageContext.js +2 -1
- package/dist/cjs/shared/hooks/executeHook.js +7 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/node/plugin/plugins/distFileNames.js +14 -8
- package/dist/esm/shared/getPageContext.d.ts +1 -1
- package/dist/esm/shared/getPageContext.js +1 -1
- package/dist/esm/shared/hooks/executeHook.d.ts +7 -0
- package/dist/esm/shared/hooks/executeHook.js +6 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
|
@@ -53,7 +53,8 @@ function distFileNames() {
|
|
|
53
53
|
}
|
|
54
54
|
// Disable CSS bundling to workaround https://github.com/vikejs/vike/issues/1815
|
|
55
55
|
if (id.endsWith('.css')) {
|
|
56
|
-
|
|
56
|
+
const userRootDir = config.root;
|
|
57
|
+
if (id.startsWith(userRootDir)) {
|
|
57
58
|
(0, utils_js_1.assertPosixPath)(id);
|
|
58
59
|
(0, getFilePath_js_1.assertModuleId)(id);
|
|
59
60
|
let name;
|
|
@@ -65,10 +66,10 @@ function distFileNames() {
|
|
|
65
66
|
const filePath = (0, getFilePath_js_1.getModuleFilePathAbsolute)(id, config);
|
|
66
67
|
name = filePath;
|
|
67
68
|
name = name.split('.').slice(0, -1).join('.'); // remove file extension
|
|
68
|
-
name = name.split('/').join('_');
|
|
69
|
+
name = name.split('/').filter(Boolean).join('_');
|
|
69
70
|
}
|
|
70
71
|
// Make fileHash the same between local development and CI
|
|
71
|
-
const idStable = path_1.default.posix.relative(
|
|
72
|
+
const idStable = path_1.default.posix.relative(userRootDir, id);
|
|
72
73
|
// Don't remove `?` queries because each `id` should belong to a unique bundle.
|
|
73
74
|
const hash = getIdHash(idStable);
|
|
74
75
|
return `${name}-${hash}`;
|
|
@@ -76,13 +77,18 @@ function distFileNames() {
|
|
|
76
77
|
else {
|
|
77
78
|
let name;
|
|
78
79
|
const isVirtualModule = id.match(/virtual:([^:]+):/);
|
|
79
|
-
if (
|
|
80
|
-
name = 'style';
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
80
|
+
if (isVirtualModule) {
|
|
83
81
|
name = isVirtualModule[1];
|
|
84
82
|
(0, utils_js_1.assert)(name);
|
|
85
83
|
}
|
|
84
|
+
else if (
|
|
85
|
+
// https://github.com/vikejs/vike/issues/1818#issuecomment-2298478321
|
|
86
|
+
id.startsWith('/__uno')) {
|
|
87
|
+
name = 'uno';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
name = 'style';
|
|
91
|
+
}
|
|
86
92
|
const hash = getIdHash(id);
|
|
87
93
|
return `${name}-${hash}`;
|
|
88
94
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPageContext = void 0;
|
|
3
|
+
exports.providePageContext = exports.getPageContext = void 0;
|
|
4
4
|
var executeHook_js_1 = require("./hooks/executeHook.js");
|
|
5
5
|
Object.defineProperty(exports, "getPageContext", { enumerable: true, get: function () { return executeHook_js_1.getPageContext; } });
|
|
6
|
+
Object.defineProperty(exports, "providePageContext", { enumerable: true, get: function () { return executeHook_js_1.providePageContext; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUserHookError = exports.getPageContext = exports.executeHook = void 0;
|
|
3
|
+
exports.isUserHookError = exports.providePageContext = exports.getPageContext = exports.executeHook = void 0;
|
|
4
4
|
const assert_js_1 = require("../../utils/assert.js");
|
|
5
5
|
const getGlobalObject_js_1 = require("../../utils/getGlobalObject.js");
|
|
6
6
|
const humanizeTime_js_1 = require("../../utils/humanizeTime.js");
|
|
@@ -72,6 +72,11 @@ function getPageContext() {
|
|
|
72
72
|
return globalObject.pageContext;
|
|
73
73
|
}
|
|
74
74
|
exports.getPageContext = getPageContext;
|
|
75
|
+
/**
|
|
76
|
+
* Provide `pageContext` for universal hooks.
|
|
77
|
+
*
|
|
78
|
+
* https://vike.dev/getPageContext
|
|
79
|
+
*/
|
|
75
80
|
function providePageContext(pageContext) {
|
|
76
81
|
globalObject.pageContext = pageContext;
|
|
77
82
|
// Promise.resolve() is quicker than process.nextTick() and setImmediate()
|
|
@@ -80,3 +85,4 @@ function providePageContext(pageContext) {
|
|
|
80
85
|
globalObject.pageContext = null;
|
|
81
86
|
});
|
|
82
87
|
}
|
|
88
|
+
exports.providePageContext = providePageContext;
|
|
@@ -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, isCallable
|
|
5
|
+
import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '../utils.js';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import crypto from 'crypto';
|
|
8
8
|
import { getAssetsDir } from '../shared/getAssetsDir.js';
|
|
@@ -48,7 +48,8 @@ function distFileNames() {
|
|
|
48
48
|
}
|
|
49
49
|
// Disable CSS bundling to workaround https://github.com/vikejs/vike/issues/1815
|
|
50
50
|
if (id.endsWith('.css')) {
|
|
51
|
-
|
|
51
|
+
const userRootDir = config.root;
|
|
52
|
+
if (id.startsWith(userRootDir)) {
|
|
52
53
|
assertPosixPath(id);
|
|
53
54
|
assertModuleId(id);
|
|
54
55
|
let name;
|
|
@@ -60,10 +61,10 @@ function distFileNames() {
|
|
|
60
61
|
const filePath = getModuleFilePathAbsolute(id, config);
|
|
61
62
|
name = filePath;
|
|
62
63
|
name = name.split('.').slice(0, -1).join('.'); // remove file extension
|
|
63
|
-
name = name.split('/').join('_');
|
|
64
|
+
name = name.split('/').filter(Boolean).join('_');
|
|
64
65
|
}
|
|
65
66
|
// Make fileHash the same between local development and CI
|
|
66
|
-
const idStable = path.posix.relative(
|
|
67
|
+
const idStable = path.posix.relative(userRootDir, id);
|
|
67
68
|
// Don't remove `?` queries because each `id` should belong to a unique bundle.
|
|
68
69
|
const hash = getIdHash(idStable);
|
|
69
70
|
return `${name}-${hash}`;
|
|
@@ -71,13 +72,18 @@ function distFileNames() {
|
|
|
71
72
|
else {
|
|
72
73
|
let name;
|
|
73
74
|
const isVirtualModule = id.match(/virtual:([^:]+):/);
|
|
74
|
-
if (
|
|
75
|
-
name = 'style';
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
75
|
+
if (isVirtualModule) {
|
|
78
76
|
name = isVirtualModule[1];
|
|
79
77
|
assert(name);
|
|
80
78
|
}
|
|
79
|
+
else if (
|
|
80
|
+
// https://github.com/vikejs/vike/issues/1818#issuecomment-2298478321
|
|
81
|
+
id.startsWith('/__uno')) {
|
|
82
|
+
name = 'uno';
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
name = 'style';
|
|
86
|
+
}
|
|
81
87
|
const hash = getIdHash(id);
|
|
82
88
|
return `${name}-${hash}`;
|
|
83
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getPageContext } from './hooks/executeHook.js';
|
|
1
|
+
export { getPageContext, providePageContext } from './hooks/executeHook.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getPageContext } from './hooks/executeHook.js';
|
|
1
|
+
export { getPageContext, providePageContext } from './hooks/executeHook.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { executeHook };
|
|
2
2
|
export { getPageContext };
|
|
3
|
+
export { providePageContext };
|
|
3
4
|
export { isUserHookError };
|
|
4
5
|
import type { PageContextClient, PageContextServer } from '../types.js';
|
|
5
6
|
import type { Hook, HookLoc } from './getHook.js';
|
|
@@ -12,3 +13,9 @@ declare function executeHook<T = unknown>(hookFnCaller: () => T, hook: Omit<Hook
|
|
|
12
13
|
* https://vike.dev/getPageContext
|
|
13
14
|
*/
|
|
14
15
|
declare function getPageContext<PageContext = PageContextClient | PageContextServer>(): null | PageContext;
|
|
16
|
+
/**
|
|
17
|
+
* Provide `pageContext` for universal hooks.
|
|
18
|
+
*
|
|
19
|
+
* https://vike.dev/getPageContext
|
|
20
|
+
*/
|
|
21
|
+
declare function providePageContext(pageContext: PageContextUnknown): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { executeHook };
|
|
2
2
|
export { getPageContext };
|
|
3
|
+
export { providePageContext };
|
|
3
4
|
export { isUserHookError };
|
|
4
5
|
import { getProjectError, assertWarning } from '../../utils/assert.js';
|
|
5
6
|
import { getGlobalObject } from '../../utils/getGlobalObject.js';
|
|
@@ -69,6 +70,11 @@ function isNotDisabled(timeout) {
|
|
|
69
70
|
function getPageContext() {
|
|
70
71
|
return globalObject.pageContext;
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Provide `pageContext` for universal hooks.
|
|
75
|
+
*
|
|
76
|
+
* https://vike.dev/getPageContext
|
|
77
|
+
*/
|
|
72
78
|
function providePageContext(pageContext) {
|
|
73
79
|
globalObject.pageContext = pageContext;
|
|
74
80
|
// Promise.resolve() is quicker than process.nextTick() and setImmediate()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.191";
|
|
@@ -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.191';
|