@blocklet/pages-kit 0.4.93 → 0.4.95
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/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/types/builtin.js +2 -1
- package/lib/cjs/utils/inject-global-components.js +13 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/types/builtin.js +1 -0
- package/lib/esm/utils/inject-global-components.js +14 -2
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/builtin.d.ts +1 -0
- package/package.json +7 -7
package/lib/esm/types/builtin.js
CHANGED
|
@@ -26,8 +26,9 @@ import * as utils from '../builtin/utils';
|
|
|
26
26
|
import * as zustand from '../builtin/zustand';
|
|
27
27
|
import * as zustandMiddlewareImmer from '../builtin/zustand/middleware/immer';
|
|
28
28
|
import CustomComponentRenderer from '../components/CustomComponentRenderer';
|
|
29
|
-
import { BuiltinModulesGlobalVariableName } from '../types/builtin';
|
|
29
|
+
import { BuiltinModulesGlobalVariableName, ChunksMountPointGlobalVariableName } from '../types/builtin';
|
|
30
30
|
import { isRelativeModule } from './typescript/builtin-module-transformer';
|
|
31
|
+
const { getComponentMountPoint } = utils;
|
|
31
32
|
// Initialize ES Module Shims before any imports
|
|
32
33
|
export function injectGlobalComponents() {
|
|
33
34
|
const win = window || {};
|
|
@@ -91,7 +92,18 @@ export function injectGlobalComponents() {
|
|
|
91
92
|
// handle relative path import
|
|
92
93
|
if (isRelativeModule(module)) {
|
|
93
94
|
const fileName = module.split('/').pop();
|
|
94
|
-
|
|
95
|
+
// real chunks mount point
|
|
96
|
+
// 1. from window global variable ChunksMountPointGlobalVariableName
|
|
97
|
+
// 2. from pages kit blocklet component mount point
|
|
98
|
+
// 3. from window.blocklet.prefix
|
|
99
|
+
// 4. from default /
|
|
100
|
+
const relativeChunksMountPoint =
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
window[ChunksMountPointGlobalVariableName] ||
|
|
103
|
+
getComponentMountPoint('pages-kit') ||
|
|
104
|
+
window?.blocklet?.prefix ||
|
|
105
|
+
'/';
|
|
106
|
+
const fullUrl = joinURL(window.location.origin, relativeChunksMountPoint, 'chunks', fileName);
|
|
95
107
|
if (enableShim) {
|
|
96
108
|
const mod = window.importShim(/* @vite-ignore */ fullUrl);
|
|
97
109
|
return mod;
|