@mpcore/simulator 1.3.1 → 1.3.2

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/index.d.mts CHANGED
@@ -20,7 +20,7 @@ export declare function normalizeComponentPageDefinition(definition: HeadlessCom
20
20
  export declare function createHostRegistries(): HeadlessHostRegistries;
21
21
  export declare function registerAppDefinition(registries: HeadlessHostRegistries, definition: HeadlessAppDefinition): HeadlessAppDefinition;
22
22
  export declare function registerPageDefinition(registries: HeadlessHostRegistries, definition: HeadlessPageDefinition, explicitRoute?: string): HeadlessPageDefinition;
23
- export declare function registerComponentDefinition(registries: HeadlessHostRegistries, definition: HeadlessComponentDefinition): HeadlessComponentDefinition;
23
+ export declare function registerComponentDefinition(registries: HeadlessHostRegistries, definition: HeadlessComponentDefinition): HeadlessPageDefinition;
24
24
  export declare function registerExportedComponentDefinition(registries: HeadlessHostRegistries, id: string, moduleExports: Record<string, any>, registeredDefinition?: HeadlessComponentDefinition): HeadlessComponentDefinition | null;
25
25
  interface HeadlessNavigationBarSnapshot {
26
26
  animation: {
package/dist/index.mjs CHANGED
@@ -1456,7 +1456,8 @@ function createWorkerHost(options) {
1456
1456
  setTimeout: scheduler.setTimeout.bind(scheduler),
1457
1457
  clearTimeout: scheduler.clearTimeout.bind(scheduler),
1458
1458
  setInterval: scheduler.setInterval.bind(scheduler),
1459
- clearInterval: scheduler.clearInterval.bind(scheduler)
1459
+ clearInterval: scheduler.clearInterval.bind(scheduler),
1460
+ ...options.globals
1460
1461
  };
1461
1462
  globals.globalThis = globals;
1462
1463
  const execute = options.createExecutor(globals);
@@ -1723,6 +1724,7 @@ function createBrowserModuleLoader(files, registries, getCurrentPages, getApp, w
1723
1724
  const workers = createWorkerHost({
1724
1725
  root: options.miniprogramRootPath,
1725
1726
  read: (file) => readBrowserVirtualFile(files, file),
1727
+ globals: { WXWebAssembly: createPackageWebAssembly((file) => readBrowserVirtualBinary(files, join(options.miniprogramRootPath, file))) },
1726
1728
  console: options.kernel.diagnostics.createConsole(),
1727
1729
  createExecutor(globals) {
1728
1730
  return (source, _file, module, require) => {
@@ -10826,6 +10828,7 @@ function createModuleLoader(registries, getCurrentPages, getApp, wxDriver, optio
10826
10828
  const workers = createWorkerHost({
10827
10829
  root: options.miniprogramRootPath,
10828
10830
  read: (file) => options.artifactSource.readText(file),
10831
+ globals: { WXWebAssembly: createPackageWebAssembly((file) => options.artifactSource.readBinary?.(path.join(options.miniprogramRootPath, file))) },
10829
10832
  console: options.kernel.diagnostics.createConsole(console, options.onConsole),
10830
10833
  createExecutor(globals) {
10831
10834
  const realm = vm.createContext(globals);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mpcore/simulator",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.3.2",
5
5
  "description": "Headless mini-program runtime and testing kernel for the weapp-vite ecosystem",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/parser": "^8.1.0",
47
- "@weapp-core/constants": "0.5.2",
47
+ "@weapp-core/constants": "0.5.3",
48
48
  "@weapp-core/shared": "3.4.2",
49
49
  "@weapp-vite/wxml": "0.0.0",
50
50
  "css-select": "^7.0.0",