@next-core/brick-container 2.76.12 → 2.76.14
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/{dll.d0a9b7c9.js → dll.190d7b06.js} +2 -2
- package/dist/{dll.d0a9b7c9.js.map → dll.190d7b06.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/{main.6e404242cf1cc473fae5.js → main.1d7ffca7f5f0fd845b16.js} +2 -2
- package/dist/{main.6e404242cf1cc473fae5.js.map → main.1d7ffca7f5f0fd845b16.js.map} +1 -1
- package/package.json +7 -7
- package/serve/getEnv.js +5 -0
- package/serve/getProxies.js +43 -21
- package/serve/serve.js +27 -17
- package/serve/serveLocal.js +5 -3
- package/serve/utils.js +20 -6
package/serve/serveLocal.js
CHANGED
|
@@ -34,7 +34,9 @@ module.exports = (env, app) => {
|
|
|
34
34
|
|
|
35
35
|
for (const standaloneConfig of allAppsConfig) {
|
|
36
36
|
const publicRoot = standaloneConfig
|
|
37
|
-
?
|
|
37
|
+
? standaloneConfig.standaloneVersion === 2
|
|
38
|
+
? standaloneConfig.publicPrefix
|
|
39
|
+
: `${standaloneConfig.appRoot}-/`
|
|
38
40
|
: baseHref;
|
|
39
41
|
|
|
40
42
|
// 开发时默认拦截 bootstrap 请求。
|
|
@@ -73,7 +75,7 @@ module.exports = (env, app) => {
|
|
|
73
75
|
new RegExp(
|
|
74
76
|
`^${escapeRegExp(
|
|
75
77
|
`${publicRoot}bricks/${pkgId}/`
|
|
76
|
-
)}(?!dist
|
|
78
|
+
)}(?:\\d+(?:\\.\\d+)*/)?(?!dist/editors/)(.+)`
|
|
77
79
|
),
|
|
78
80
|
(req, res) => {
|
|
79
81
|
tryServeFiles(
|
|
@@ -159,7 +161,7 @@ module.exports = (env, app) => {
|
|
|
159
161
|
brief: req.query.brief === "true",
|
|
160
162
|
})
|
|
161
163
|
),
|
|
162
|
-
brickPackages: getBrickPackages(env),
|
|
164
|
+
brickPackages: getBrickPackages(env, standaloneConfig),
|
|
163
165
|
templatePackages: getTemplatePackages(env),
|
|
164
166
|
});
|
|
165
167
|
});
|
package/serve/utils.js
CHANGED
|
@@ -73,9 +73,11 @@ function getSingleStoryboard(env, microAppName, mocked, options = {}) {
|
|
|
73
73
|
return storyboard;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
function getBrickPackages(env) {
|
|
76
|
+
function getBrickPackages(env, standaloneConfig) {
|
|
77
77
|
return getNamesOfBrickPackages(env)
|
|
78
|
-
.map((name) =>
|
|
78
|
+
.map((name) =>
|
|
79
|
+
getSingleBrickPackage(env, name, undefined, standaloneConfig)
|
|
80
|
+
)
|
|
79
81
|
.filter(Boolean);
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -91,7 +93,12 @@ function getNamesOfBrickPackages(env) {
|
|
|
91
93
|
);
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
function getSingleBrickPackage(
|
|
96
|
+
function getSingleBrickPackage(
|
|
97
|
+
env,
|
|
98
|
+
brickPackageName,
|
|
99
|
+
remoteBrickPackages,
|
|
100
|
+
standaloneConfig
|
|
101
|
+
) {
|
|
95
102
|
const {
|
|
96
103
|
brickPackagesDir,
|
|
97
104
|
alternativeBrickPackagesDir,
|
|
@@ -121,10 +128,17 @@ function getSingleBrickPackage(env, brickPackageName, remoteBrickPackages) {
|
|
|
121
128
|
]);
|
|
122
129
|
if (fs.existsSync(distDir)) {
|
|
123
130
|
if (!remoteBrickPackages || localBrickPackages.includes(brickPackageName)) {
|
|
131
|
+
let versionPart = "";
|
|
132
|
+
if (standaloneConfig && standaloneConfig.standaloneVersion === 2) {
|
|
133
|
+
const packageJson = JSON.parse(
|
|
134
|
+
fs.readFileSync(path.resolve(distDir, "../package.json"))
|
|
135
|
+
);
|
|
136
|
+
versionPart = `${packageJson.version}/`;
|
|
137
|
+
}
|
|
124
138
|
let filePath, bricksJson;
|
|
125
139
|
for (const file of fs.readdirSync(distDir)) {
|
|
126
140
|
if (file.endsWith(".js")) {
|
|
127
|
-
filePath = `bricks/${brickPackageName}
|
|
141
|
+
filePath = `bricks/${brickPackageName}/${versionPart}dist/${file}`;
|
|
128
142
|
} else if (file === "bricks.json") {
|
|
129
143
|
bricksJson = JSON.parse(
|
|
130
144
|
fs.readFileSync(path.join(distDir, "bricks.json"), "utf8")
|
|
@@ -140,8 +154,8 @@ function getSingleBrickPackage(env, brickPackageName, remoteBrickPackages) {
|
|
|
140
154
|
filePath,
|
|
141
155
|
},
|
|
142
156
|
!remoteBrickPackages || localEditorPackages.includes(brickPackageName)
|
|
143
|
-
? bricksJson
|
|
144
|
-
: omit(bricksJson, ["editors", "editorsJsFilePath"])
|
|
157
|
+
? omit(bricksJson, ["filePath"])
|
|
158
|
+
: omit(bricksJson, ["filePath", "editors", "editorsJsFilePath"])
|
|
145
159
|
);
|
|
146
160
|
}
|
|
147
161
|
if (
|