@granite-js/plugin-micro-frontend 0.1.15 → 0.1.17
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/CHANGELOG.md +16 -0
- package/dist/index.cjs +9 -4
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +10 -5
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @granite-js/plugin-micro-frontend
|
|
2
2
|
|
|
3
|
+
## 0.1.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [9c415df]
|
|
8
|
+
- @granite-js/plugin-core@0.1.17
|
|
9
|
+
- @granite-js/utils@0.1.17
|
|
10
|
+
|
|
11
|
+
## 0.1.16
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 1678419: improve plugin options
|
|
16
|
+
- @granite-js/plugin-core@0.1.16
|
|
17
|
+
- @granite-js/utils@0.1.16
|
|
18
|
+
|
|
3
19
|
## 0.1.15
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -101,13 +101,18 @@ async function fetchBundle(remote, platform) {
|
|
|
101
101
|
return bundle;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/utils/resolveReactNativeBasePath.ts
|
|
106
|
+
function resolveReactNativeBasePath() {
|
|
107
|
+
return path.default.dirname(require.resolve("react-native/package.json", { paths: [(0, __granite_js_utils.getPackageRoot)()] }));
|
|
108
|
+
}
|
|
109
|
+
|
|
104
110
|
//#endregion
|
|
105
111
|
//#region src/resolver.ts
|
|
106
112
|
const VIRTUAL_INITIALIZE_CORE_PROTOCOL = "virtual-initialize-core";
|
|
107
113
|
const VIRTUAL_SHARED_PROTOCOL = "virtual-shared";
|
|
108
|
-
function virtualInitializeCoreConfig() {
|
|
109
|
-
const
|
|
110
|
-
const initializeCorePath = path.join(reactNativePath, "Libraries/Core/InitializeCore.js");
|
|
114
|
+
function virtualInitializeCoreConfig(reactNativeBasePath = resolveReactNativeBasePath()) {
|
|
115
|
+
const initializeCorePath = path.join(reactNativeBasePath, "Libraries/Core/InitializeCore.js");
|
|
111
116
|
const alias = [{
|
|
112
117
|
from: `prelude:${initializeCorePath}`,
|
|
113
118
|
to: `${VIRTUAL_INITIALIZE_CORE_PROTOCOL}:noop`,
|
|
@@ -179,7 +184,7 @@ const microFrontendPlugin = async (options) => {
|
|
|
179
184
|
* `InitializeCore.js` must be excluded from the bundle to ensure the core is loaded only once per runtime.
|
|
180
185
|
*/
|
|
181
186
|
const shouldExcludeReactNativeInitializeCore = Boolean(nonEagerEntries.find(([libName]) => libName === "react-native"));
|
|
182
|
-
const virtualInitializeCore = shouldExcludeReactNativeInitializeCore ? virtualInitializeCoreConfig() : void 0;
|
|
187
|
+
const virtualInitializeCore = shouldExcludeReactNativeInitializeCore ? virtualInitializeCoreConfig(options.reactNativeBasePath) : void 0;
|
|
183
188
|
const virtualShared = virtualSharedConfig(nonEagerEntries);
|
|
184
189
|
return {
|
|
185
190
|
name: "micro-frontend-plugin",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { GranitePluginCore } from "@granite-js/plugin-core";
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
|
-
interface MicroFrontendPluginOptions {
|
|
4
|
+
interface MicroFrontendPluginOptions extends MicroFrontendOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Path to react-native base directory.
|
|
7
|
+
*
|
|
8
|
+
* Defaults to project's `react-native` directory.
|
|
9
|
+
*/
|
|
10
|
+
reactNativeBasePath?: string;
|
|
11
|
+
}
|
|
12
|
+
interface MicroFrontendOptions {
|
|
5
13
|
/**
|
|
6
14
|
* Container name
|
|
7
15
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { GranitePluginCore } from "@granite-js/plugin-core";
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
|
-
interface MicroFrontendPluginOptions {
|
|
4
|
+
interface MicroFrontendPluginOptions extends MicroFrontendOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Path to react-native base directory.
|
|
7
|
+
*
|
|
8
|
+
* Defaults to project's `react-native` directory.
|
|
9
|
+
*/
|
|
10
|
+
reactNativeBasePath?: string;
|
|
11
|
+
}
|
|
12
|
+
interface MicroFrontendOptions {
|
|
5
13
|
/**
|
|
6
14
|
* Container name
|
|
7
15
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as fs from "fs";
|
|
|
3
3
|
import * as path$2 from "path";
|
|
4
4
|
import * as path$1 from "path";
|
|
5
5
|
import path from "path";
|
|
6
|
-
import { prepareLocalDirectory } from "@granite-js/utils";
|
|
6
|
+
import { getPackageRoot, prepareLocalDirectory } from "@granite-js/utils";
|
|
7
7
|
import pc from "picocolors";
|
|
8
8
|
|
|
9
9
|
//#region rolldown:runtime
|
|
@@ -85,13 +85,18 @@ async function fetchBundle(remote, platform) {
|
|
|
85
85
|
return bundle;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/utils/resolveReactNativeBasePath.ts
|
|
90
|
+
function resolveReactNativeBasePath() {
|
|
91
|
+
return path.dirname(__require.resolve("react-native/package.json", { paths: [getPackageRoot()] }));
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
//#endregion
|
|
89
95
|
//#region src/resolver.ts
|
|
90
96
|
const VIRTUAL_INITIALIZE_CORE_PROTOCOL = "virtual-initialize-core";
|
|
91
97
|
const VIRTUAL_SHARED_PROTOCOL = "virtual-shared";
|
|
92
|
-
function virtualInitializeCoreConfig() {
|
|
93
|
-
const
|
|
94
|
-
const initializeCorePath = path$2.join(reactNativePath, "Libraries/Core/InitializeCore.js");
|
|
98
|
+
function virtualInitializeCoreConfig(reactNativeBasePath = resolveReactNativeBasePath()) {
|
|
99
|
+
const initializeCorePath = path$2.join(reactNativeBasePath, "Libraries/Core/InitializeCore.js");
|
|
95
100
|
const alias = [{
|
|
96
101
|
from: `prelude:${initializeCorePath}`,
|
|
97
102
|
to: `${VIRTUAL_INITIALIZE_CORE_PROTOCOL}:noop`,
|
|
@@ -163,7 +168,7 @@ const microFrontendPlugin = async (options) => {
|
|
|
163
168
|
* `InitializeCore.js` must be excluded from the bundle to ensure the core is loaded only once per runtime.
|
|
164
169
|
*/
|
|
165
170
|
const shouldExcludeReactNativeInitializeCore = Boolean(nonEagerEntries.find(([libName]) => libName === "react-native"));
|
|
166
|
-
const virtualInitializeCore = shouldExcludeReactNativeInitializeCore ? virtualInitializeCoreConfig() : void 0;
|
|
171
|
+
const virtualInitializeCore = shouldExcludeReactNativeInitializeCore ? virtualInitializeCoreConfig(options.reactNativeBasePath) : void 0;
|
|
167
172
|
const virtualShared = virtualSharedConfig(nonEagerEntries);
|
|
168
173
|
return {
|
|
169
174
|
name: "micro-frontend-plugin",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granite-js/plugin-micro-frontend",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.17",
|
|
5
5
|
"description": "Plugin for micro frontend",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"vitest": "^3.2.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@granite-js/plugin-core": "0.1.
|
|
48
|
-
"@granite-js/utils": "0.1.
|
|
47
|
+
"@granite-js/plugin-core": "0.1.17",
|
|
48
|
+
"@granite-js/utils": "0.1.17",
|
|
49
49
|
"es-toolkit": "^1.39.8",
|
|
50
50
|
"picocolors": "^1.1.1"
|
|
51
51
|
},
|