@monkeyplus/flow 6.0.10 → 6.0.11
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.
|
@@ -28,6 +28,9 @@ function getFlowImagesRuntimeConfig() {
|
|
|
28
28
|
return getEnvFlowImagesRuntimeConfig();
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
function shouldExposeStrapiUrlToClient() {
|
|
32
|
+
return process.env.NODE_ENV !== "production";
|
|
33
|
+
}
|
|
31
34
|
export function getFlowImageBootPayload(config = getFlowImagesRuntimeConfig()) {
|
|
32
35
|
if (!config) {
|
|
33
36
|
return void 0;
|
|
@@ -36,7 +39,8 @@ export function getFlowImageBootPayload(config = getFlowImagesRuntimeConfig()) {
|
|
|
36
39
|
return {
|
|
37
40
|
all: loadImageRenames(renameSources),
|
|
38
41
|
options: { ...config.options },
|
|
39
|
-
generateOutput: !!config.generate
|
|
42
|
+
generateOutput: !!config.generate,
|
|
43
|
+
...shouldExposeStrapiUrlToClient() && config.strapiURL ? { strapiURL: config.strapiURL } : {}
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
export function getFlowImageRuntimeUtils(config = getFlowImagesRuntimeConfig()) {
|
package/package.json
CHANGED
package/src/public/vite.mjs
CHANGED
|
@@ -31,11 +31,13 @@ const flowRestartPatterns = [
|
|
|
31
31
|
/^entry-server\.ts$/
|
|
32
32
|
];
|
|
33
33
|
const flowFullReloadPatterns = [
|
|
34
|
+
/^views\/.+\.vue$/,
|
|
34
35
|
/^client\/pages\/.+\.ts$/,
|
|
35
36
|
/^client\/islands\/.+\.ts$/
|
|
36
37
|
];
|
|
37
38
|
const flowStructureReloadPatterns = [
|
|
38
39
|
/^pages\/.+\.ts$/,
|
|
40
|
+
/^views\/.+\.vue$/,
|
|
39
41
|
/^views\/templates\/.+\.vue$/,
|
|
40
42
|
/^views\/layouts\/.+\.vue$/,
|
|
41
43
|
/^views\/base\/.+\.html$/,
|
|
@@ -103,7 +105,22 @@ function invalidateFileModules(server, filePath, event) {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
|
-
function
|
|
108
|
+
function normalizeWatchPaths(projectRoot, ...groups) {
|
|
109
|
+
const paths = /* @__PURE__ */ new Set();
|
|
110
|
+
for (const group of groups) {
|
|
111
|
+
if (!Array.isArray(group)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
for (const entry of group) {
|
|
115
|
+
if (typeof entry !== "string" || !entry) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
paths.add(resolve(projectRoot, entry));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return [...paths];
|
|
122
|
+
}
|
|
123
|
+
function createFlowHotReload(projectRoot, extraWatchPaths = []) {
|
|
107
124
|
let restartPending = false;
|
|
108
125
|
function toProjectPath(filePath) {
|
|
109
126
|
return normalizePath(relative(projectRoot, filePath));
|
|
@@ -138,6 +155,9 @@ function createFlowHotReload(projectRoot) {
|
|
|
138
155
|
return {
|
|
139
156
|
name: "flow:hot-reload",
|
|
140
157
|
configureServer(server) {
|
|
158
|
+
if (extraWatchPaths.length) {
|
|
159
|
+
server.watcher.add(extraWatchPaths);
|
|
160
|
+
}
|
|
141
161
|
server.watcher.on("add", (filePath) => {
|
|
142
162
|
void handleServerChange(server, filePath, "add");
|
|
143
163
|
});
|
|
@@ -214,11 +234,19 @@ export function createFlowViteConfig(options = {}) {
|
|
|
214
234
|
const moduleServer = flowModules.vite.server || { watch: { additionalPaths: [] } };
|
|
215
235
|
const configuredWatch = typeof configuredServer.watch === "object" && configuredServer.watch ? configuredServer.watch : {};
|
|
216
236
|
const moduleWatch = typeof moduleServer.watch === "object" && moduleServer.watch ? moduleServer.watch : {};
|
|
237
|
+
const configuredComponents = typeof flowConfig.components === "object" && flowConfig.components ? flowConfig.components : {};
|
|
238
|
+
const componentDirs = Array.isArray(configuredComponents.dirs) ? configuredComponents.dirs.filter((entry) => typeof entry === "string") : [];
|
|
239
|
+
const extraWatchPaths = normalizeWatchPaths(
|
|
240
|
+
projectRoot,
|
|
241
|
+
configuredWatch.additionalPaths,
|
|
242
|
+
moduleWatch.additionalPaths,
|
|
243
|
+
componentDirs
|
|
244
|
+
);
|
|
217
245
|
return defineConfig({
|
|
218
246
|
plugins: [
|
|
219
247
|
createFlowVirtualServerModules(projectRoot, flowConfig),
|
|
220
248
|
createFlowVirtualClientPages(projectRoot),
|
|
221
|
-
createFlowHotReload(projectRoot),
|
|
249
|
+
createFlowHotReload(projectRoot, extraWatchPaths),
|
|
222
250
|
...flowModules.vite.plugins,
|
|
223
251
|
Icons({
|
|
224
252
|
autoInstall: true,
|
package/src/runtime/boot.d.ts
CHANGED
|
@@ -42,7 +42,8 @@ export function createBootImageUtils(boot) {
|
|
|
42
42
|
generate: {}
|
|
43
43
|
};
|
|
44
44
|
const resolver = createImageResolver(snapshot.options, stateImages, {
|
|
45
|
-
generateOutput: snapshot.generateOutput
|
|
45
|
+
generateOutput: snapshot.generateOutput,
|
|
46
|
+
strapiURL: snapshot.strapiURL
|
|
46
47
|
});
|
|
47
48
|
return {
|
|
48
49
|
getImage: resolver.getImage,
|