@monkeyplus/flow 5.0.0-beta.11 → 5.0.0-beta.12
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/index.mjs
CHANGED
|
@@ -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.12";
|
|
31
31
|
|
|
32
32
|
let _distDir = dirname(fileURLToPath(import.meta.url));
|
|
33
33
|
if (_distDir.endsWith("chunks"))
|
|
@@ -316,7 +316,7 @@ const createClient = async (flow) => {
|
|
|
316
316
|
if (vite)
|
|
317
317
|
vite?.ws?.send({ type: "full-reload" });
|
|
318
318
|
};
|
|
319
|
-
const doReload = debounce(_doReload,
|
|
319
|
+
const doReload = debounce(_doReload, 60);
|
|
320
320
|
flow.hook("bundler:change", () => {
|
|
321
321
|
doReload();
|
|
322
322
|
});
|
|
@@ -340,14 +340,17 @@ const builClient = async (flow) => {
|
|
|
340
340
|
|
|
341
341
|
const viteModule = defineFlowModule({
|
|
342
342
|
meta: {
|
|
343
|
-
name: "
|
|
343
|
+
name: "vite-client",
|
|
344
|
+
configKey: "bundle"
|
|
344
345
|
},
|
|
345
346
|
defaults: {
|
|
346
|
-
route: "/_vite/"
|
|
347
|
+
route: "/_vite/",
|
|
348
|
+
dir: "/client/pages"
|
|
347
349
|
},
|
|
348
350
|
async setup(_options, flow) {
|
|
349
351
|
const runtimeDir = resolve(distDir, "vite-client/runtime");
|
|
350
352
|
flow.options.alias["#viteManifest"] = resolve(flow.options.buildDir, "viteManifest.mjs");
|
|
353
|
+
console.log(_options);
|
|
351
354
|
let vite;
|
|
352
355
|
if (flow.options.dev) {
|
|
353
356
|
flow.hook("nitro:init", async (nitro) => {
|
|
@@ -362,9 +365,9 @@ const viteModule = defineFlowModule({
|
|
|
362
365
|
async getContents() {
|
|
363
366
|
return [
|
|
364
367
|
"export default {",
|
|
365
|
-
|
|
368
|
+
`head:()=>'<script type="module" src="${joinURL("/", _options.route, "/@vite/client")}"><\/script>'`,
|
|
366
369
|
",",
|
|
367
|
-
|
|
370
|
+
`body: (bundle)=>\`<script type="module" src="${joinURL("/", _options.route, _options.dir)}/\${bundle}.ts"><\/script>\``,
|
|
368
371
|
"}"
|
|
369
372
|
].join("\n");
|
|
370
373
|
}
|
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.12",
|
|
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.12",
|
|
18
|
+
"@monkeyplus/flow-kit": "5.0.0-beta.12",
|
|
19
|
+
"@monkeyplus/flow-schema": "5.0.0-beta.12",
|
|
20
20
|
"@rollup/plugin-replace": "^4.0.0",
|
|
21
21
|
"@vueuse/head": "^0.7.6",
|
|
22
22
|
"c12": "^0.2.7",
|
|
@@ -25,7 +25,7 @@ export const createClient = async(flow: Flow) => {
|
|
|
25
25
|
vite?.ws?.send({ type: 'full-reload' });
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const doReload = debounce(_doReload,
|
|
28
|
+
const doReload = debounce(_doReload, 60);
|
|
29
29
|
|
|
30
30
|
// Use this to refresh page
|
|
31
31
|
flow.hook('bundler:change', () => {
|
|
@@ -4,23 +4,28 @@ import { resolve } from 'pathe';
|
|
|
4
4
|
// import { genImport } from 'knitwork';
|
|
5
5
|
import fse from 'fs-extra';
|
|
6
6
|
import logger from 'consola';
|
|
7
|
+
import { joinURL } from 'ufo';
|
|
7
8
|
import { builClient, createClient } from '../core/vite/client';
|
|
8
9
|
import { distDir } from '../dirs';
|
|
9
10
|
|
|
10
11
|
interface OptionsViteClient{
|
|
11
12
|
route: string
|
|
13
|
+
dir: string
|
|
12
14
|
}
|
|
13
15
|
export default defineFlowModule<OptionsViteClient>({
|
|
14
16
|
|
|
15
17
|
meta: {
|
|
16
|
-
name: '
|
|
18
|
+
name: 'vite-client',
|
|
19
|
+
configKey: 'bundle',
|
|
17
20
|
},
|
|
18
21
|
defaults: {
|
|
19
22
|
route: '/_vite/',
|
|
23
|
+
dir: '/client/pages',
|
|
20
24
|
},
|
|
21
25
|
async setup(_options, flow) {
|
|
22
26
|
const runtimeDir = resolve(distDir, 'vite-client/runtime');
|
|
23
27
|
flow.options.alias['#viteManifest'] = resolve(flow.options.buildDir, 'viteManifest.mjs');
|
|
28
|
+
console.log(_options);
|
|
24
29
|
|
|
25
30
|
let vite: any;
|
|
26
31
|
if (flow.options.dev) {
|
|
@@ -43,10 +48,10 @@ export default defineFlowModule<OptionsViteClient>({
|
|
|
43
48
|
filename: 'viteManifest.mjs',
|
|
44
49
|
async getContents() {
|
|
45
50
|
return ['export default {',
|
|
46
|
-
|
|
51
|
+
`head:()=>'<script type="module" src="${joinURL('/', _options.route, '/@vite/client')}"></script>'`,
|
|
47
52
|
',',
|
|
48
53
|
// eslint-disable-next-line no-template-curly-in-string
|
|
49
|
-
|
|
54
|
+
`body: (bundle)=>\`<script type="module" src="${joinURL('/', _options.route, _options.dir)}/\${bundle}.ts"></script>\``,
|
|
50
55
|
'}',
|
|
51
56
|
].join('\n');
|
|
52
57
|
},
|