@pushwoosh/single-spa 1.1.0 → 1.3.0

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/Parcel.js CHANGED
@@ -3,6 +3,7 @@ import { useMemo } from 'react';
3
3
  import { mountRootParcel } from 'single-spa';
4
4
  import SingleSpaParcel from 'single-spa-react/parcel';
5
5
  import { useSPAContext } from '@pushwoosh/spa-context';
6
+ import { loadModule } from './loadModule';
6
7
  export const Parcel = ({
7
8
  className,
8
9
  module,
@@ -14,7 +15,7 @@ export const Parcel = ({
14
15
  let parcel;
15
16
  return {
16
17
  bootstrap(props) {
17
- return System.import(module).then(imported => {
18
+ return loadModule(module).then(imported => {
18
19
  // eslint-disable-next-line react/prop-types, react-hooks/immutability
19
20
  parcel = imported[parcelFunctionName](props.domElement);
20
21
  });
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './Parcel';
2
2
  export { createParcelFunction } from './createParcelFunction';
3
3
  export { createApplicationFunction } from './createApplicationFunction';
4
+ export { loadModule } from './loadModule';
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './Parcel';
2
2
  export { createParcelFunction } from './createParcelFunction';
3
- export { createApplicationFunction } from './createApplicationFunction';
3
+ export { createApplicationFunction } from './createApplicationFunction';
4
+ export { loadModule } from './loadModule';
@@ -0,0 +1,2 @@
1
+ /** Loads a module by import-map name through native `import()`. */
2
+ export declare function loadModule<T = unknown>(name: string): Promise<T>;
package/loadModule.js ADDED
@@ -0,0 +1,4 @@
1
+ /** Loads a module by import-map name through native `import()`. */
2
+ export function loadModule(name) {
3
+ return import(/* webpackIgnore: true */name);
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/single-spa",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "single-spa lifecycle helpers for Pushwoosh micro-frontends: application and parcel factories wrapped in SPAContextProvider",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,8 @@
24
24
  "@types/react": "^19.3.0",
25
25
  "@types/react-dom": "^19.3.0",
26
26
  "react": "^19.3.0",
27
- "react-dom": "^19.3.0"
27
+ "react-dom": "^19.3.0",
28
+ "vitest": "^4.1.10"
28
29
  },
29
30
  "peerDependencies": {
30
31
  "@pushwoosh/spa-context": "^1.7.1 || ^2.0.0 || ^3.0.0",
@@ -36,9 +37,10 @@
36
37
  },
37
38
  "scripts": {
38
39
  "build": "pushwoosh-engine lib:build",
39
- "check": "pnpm run check:lint && pnpm run check:types",
40
+ "check": "pnpm run check:lint && pnpm run check:types && pnpm run test",
40
41
  "check:lint": "echo \"Run check:lint\" && NODE_ENV=production eslint ./src",
41
42
  "check:lint-fix": "echo \"Run check:lint\" && NODE_ENV=production eslint ./src --fix",
42
- "check:types": "echo \"Run check:types\" && pushwoosh-engine lib:check-types"
43
+ "check:types": "echo \"Run check:types\" && pushwoosh-engine lib:check-types",
44
+ "test": "echo \"Run test\" && vitest run"
43
45
  }
44
46
  }