@blocklet/pages-kit 0.4.94 → 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.
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuiltinModulesGlobalVariableName = void 0;
3
+ exports.ChunksMountPointGlobalVariableName = exports.BuiltinModulesGlobalVariableName = void 0;
4
4
  exports.BuiltinModulesGlobalVariableName = '__PAGES_KIT_BUILTIN_MODULES__';
5
+ exports.ChunksMountPointGlobalVariableName = '__PAGES_KIT_CHUNKS_MOUNT_POINT__';
@@ -57,6 +57,7 @@ const zustandMiddlewareImmer = __importStar(require("../builtin/zustand/middlewa
57
57
  const CustomComponentRenderer_1 = __importDefault(require("../components/CustomComponentRenderer"));
58
58
  const builtin_1 = require("../types/builtin");
59
59
  const builtin_module_transformer_1 = require("./typescript/builtin-module-transformer");
60
+ const { getComponentMountPoint } = utils;
60
61
  // Initialize ES Module Shims before any imports
61
62
  function injectGlobalComponents() {
62
63
  const win = window || {};
@@ -120,7 +121,18 @@ function injectGlobalComponents() {
120
121
  // handle relative path import
121
122
  if ((0, builtin_module_transformer_1.isRelativeModule)(module)) {
122
123
  const fileName = module.split('/').pop();
123
- const fullUrl = (0, ufo_1.joinURL)(window.location.origin, window?.blocklet?.prefix || '/', 'chunks', fileName);
124
+ // real chunks mount point
125
+ // 1. from window global variable ChunksMountPointGlobalVariableName
126
+ // 2. from pages kit blocklet component mount point
127
+ // 3. from window.blocklet.prefix
128
+ // 4. from default /
129
+ const relativeChunksMountPoint =
130
+ // @ts-ignore
131
+ window[builtin_1.ChunksMountPointGlobalVariableName] ||
132
+ getComponentMountPoint('pages-kit') ||
133
+ window?.blocklet?.prefix ||
134
+ '/';
135
+ const fullUrl = (0, ufo_1.joinURL)(window.location.origin, relativeChunksMountPoint, 'chunks', fileName);
124
136
  if (enableShim) {
125
137
  const mod = window.importShim(/* @vite-ignore */ fullUrl);
126
138
  return mod;