@pushwoosh/single-spa 1.2.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,7 +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 { loadByFormat } from './loadByFormat';
6
+ import { loadModule } from './loadModule';
7
7
  export const Parcel = ({
8
8
  className,
9
9
  module,
@@ -15,7 +15,7 @@ export const Parcel = ({
15
15
  let parcel;
16
16
  return {
17
17
  bootstrap(props) {
18
- return loadByFormat(module).then(imported => {
18
+ return loadModule(module).then(imported => {
19
19
  // eslint-disable-next-line react/prop-types, react-hooks/immutability
20
20
  parcel = imported[parcelFunctionName](props.domElement);
21
21
  });
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './Parcel';
2
2
  export { createParcelFunction } from './createParcelFunction';
3
3
  export { createApplicationFunction } from './createApplicationFunction';
4
- export { isEsmUrl, loadByFormat, resolveModuleUrl } from './loadByFormat';
4
+ export { loadModule } from './loadModule';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './Parcel';
2
2
  export { createParcelFunction } from './createParcelFunction';
3
3
  export { createApplicationFunction } from './createApplicationFunction';
4
- export { isEsmUrl, loadByFormat, resolveModuleUrl } from './loadByFormat';
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.2.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",
package/loadByFormat.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /** URL the merged root-config import map assigns to `name`, or `name` itself when the map has no entry. */
2
- export declare function resolveModuleUrl(name: string): string;
3
- /** Whether `url` points at an ES module build (`.mjs`), ignoring query and hash. */
4
- export declare function isEsmUrl(url: string): boolean;
5
- /** Loads a module by import-map name: `.mjs` entries through native `import()`, the rest through SystemJS. */
6
- export declare function loadByFormat<T = unknown>(name: string): Promise<T>;
package/loadByFormat.js DELETED
@@ -1,15 +0,0 @@
1
- /** URL the merged root-config import map assigns to `name`, or `name` itself when the map has no entry. */
2
- export function resolveModuleUrl(name) {
3
- return window.__PW_IMPORT_MAP__?.imports[name] ?? name;
4
- }
5
- /** Whether `url` points at an ES module build (`.mjs`), ignoring query and hash. */
6
- export function isEsmUrl(url) {
7
- return /\.mjs(?:[?#]|$)/.test(url);
8
- }
9
- /** Loads a module by import-map name: `.mjs` entries through native `import()`, the rest through SystemJS. */
10
- export function loadByFormat(name) {
11
- if (isEsmUrl(resolveModuleUrl(name))) {
12
- return import(/* webpackIgnore: true */name);
13
- }
14
- return System.import(name);
15
- }