@monkeyplus/flow 5.0.0-beta.3 → 5.0.0-beta.5
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.
|
@@ -10,12 +10,12 @@ export default eventHandler(async (event) => {
|
|
|
10
10
|
const chunks = { head: [], body: [] };
|
|
11
11
|
const generate = {};
|
|
12
12
|
const { page, locale, params, view } = flow.router.byUrl.lookup(url) || {};
|
|
13
|
+
if (!page)
|
|
14
|
+
return;
|
|
13
15
|
await flow.callHook("page:scripts", scripts);
|
|
14
16
|
if (view.bundle)
|
|
15
17
|
await flow.callHook("page:chunks", view.bundle, chunks);
|
|
16
18
|
const templateContext = {};
|
|
17
|
-
if (!page)
|
|
18
|
-
return;
|
|
19
19
|
const dynamyc = params?._;
|
|
20
20
|
const contextPage = {};
|
|
21
21
|
const utils = Object.assign({ getLocale: () => locale }, flow.app.utils);
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHooks } from 'hookable';
|
|
2
2
|
import { dirname, resolve, normalize, join, isAbsolute, relative, extname } from 'pathe';
|
|
3
|
-
import { defineFlowModule, addPlugin, defineNuxtModule, logger, addTemplate, addPluginTemplate, addVitePlugin, useNuxt, resolveAlias, resolveFiles,
|
|
3
|
+
import { defineFlowModule, addPlugin, defineNuxtModule, logger, addTemplate, addPluginTemplate, addVitePlugin, useNuxt, resolveAlias, resolveFiles, nuxtCtx, installModule, loadFlowConfig, templateUtils, normalizeTemplate, compileTemplate, normalizePlugin, resolveFilesFlow, isIgnoredFlow } from '@monkeyplus/flow-kit';
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
5
|
import { defineUnimportPreset, createUnimport, toImports, scanDirExports } from 'unimport';
|
|
6
6
|
import { createUnplugin } from 'unplugin';
|
|
@@ -27,7 +27,7 @@ import { isExternal as isExternal$1, ExternalsDefaults } from 'externality';
|
|
|
27
27
|
import { createHash } from 'node:crypto';
|
|
28
28
|
import MagicString from 'magic-string';
|
|
29
29
|
|
|
30
|
-
const version = "5.0.0-beta.
|
|
30
|
+
const version = "5.0.0-beta.5";
|
|
31
31
|
|
|
32
32
|
let _distDir = dirname(fileURLToPath(import.meta.url));
|
|
33
33
|
if (_distDir.endsWith("chunks"))
|
|
@@ -317,7 +317,10 @@ const createClient = async (flow) => {
|
|
|
317
317
|
doReload();
|
|
318
318
|
});
|
|
319
319
|
flow.hook("close", async () => {
|
|
320
|
-
|
|
320
|
+
try {
|
|
321
|
+
await vite.close();
|
|
322
|
+
} catch (error) {
|
|
323
|
+
}
|
|
321
324
|
});
|
|
322
325
|
return vite;
|
|
323
326
|
};
|
|
@@ -345,10 +348,12 @@ const viteModule = defineFlowModule({
|
|
|
345
348
|
const runtimeDir = resolve(distDir, "vite-client/runtime");
|
|
346
349
|
flow.options.alias["#viteManifest"] = resolve(flow.options.buildDir, "viteManifest.mjs");
|
|
347
350
|
if (flow.options.dev) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
flow.hook("nitro:init", async (nitro) => {
|
|
352
|
+
const _vite = await createClient(flow);
|
|
353
|
+
nitro.options.devHandlers.push({
|
|
354
|
+
handler: _vite.middlewares,
|
|
355
|
+
route: _options.route
|
|
356
|
+
});
|
|
352
357
|
});
|
|
353
358
|
addTemplate({
|
|
354
359
|
filename: "viteManifest.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkeyplus/flow",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"flow": "./bin/flow.mjs"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@monkeyplus/flow-cli": "5.0.0-beta.
|
|
18
|
-
"@monkeyplus/flow-kit": "5.0.0-beta.
|
|
19
|
-
"@monkeyplus/flow-schema": "5.0.0-beta.
|
|
17
|
+
"@monkeyplus/flow-cli": "5.0.0-beta.5",
|
|
18
|
+
"@monkeyplus/flow-kit": "5.0.0-beta.5",
|
|
19
|
+
"@monkeyplus/flow-schema": "5.0.0-beta.5",
|
|
20
20
|
"@nuxt/vite-builder": "3.0.0-rc.1",
|
|
21
21
|
"@rollup/plugin-replace": "^4.0.0",
|
|
22
22
|
"@vueuse/head": "^0.7.6",
|
|
@@ -17,12 +17,14 @@ export default eventHandler(async(event) => {
|
|
|
17
17
|
|
|
18
18
|
// console.log(flow);
|
|
19
19
|
const { page, locale, params, view } = flow.router.byUrl.lookup(url!) || {};
|
|
20
|
+
// Truncate page
|
|
21
|
+
if (!page) return;
|
|
22
|
+
|
|
20
23
|
await flow.callHook('page:scripts', scripts);
|
|
21
24
|
if (view.bundle)
|
|
22
25
|
await flow.callHook('page:chunks', view.bundle, chunks);
|
|
23
26
|
|
|
24
27
|
const templateContext = {} as any;
|
|
25
|
-
if (!page) return;
|
|
26
28
|
|
|
27
29
|
const dynamyc = params?._;
|
|
28
30
|
const contextPage = {} as any;
|
|
@@ -23,11 +23,14 @@ export default defineFlowModule<OptionsViteClient>({
|
|
|
23
23
|
flow.options.alias['#viteManifest'] = resolve(flow.options.buildDir, 'viteManifest.mjs');
|
|
24
24
|
|
|
25
25
|
if (flow.options.dev) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
flow.hook('nitro:init', async(nitro) => {
|
|
27
|
+
const _vite = await createClient(flow);
|
|
28
|
+
nitro.options.devHandlers.push({
|
|
29
|
+
handler: _vite.middlewares,
|
|
30
|
+
route: _options.route,
|
|
31
|
+
});
|
|
30
32
|
});
|
|
33
|
+
|
|
31
34
|
addTemplate({
|
|
32
35
|
filename: 'viteManifest.mjs',
|
|
33
36
|
async getContents() {
|