@deot/dev-dever 2.9.9 → 2.9.10

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.
Files changed (3) hide show
  1. package/dist/index.cjs +132 -138
  2. package/dist/index.js +103 -114
  3. package/package.json +7 -7
package/dist/index.cjs CHANGED
@@ -1,144 +1,138 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const path = require('node:path');
6
- const node_url = require('node:url');
7
- const devShared = require('@deot/dev-shared');
8
- const fs$1 = require('fs-extra');
9
- const vite = require('vite');
10
- const chalk = require('chalk');
11
- const sharedVueConfig = require('@deot/dev-vue');
12
- const sharedReactConfig = require('@deot/dev-react');
13
- const fs = require('node:fs');
14
- const ejs = require('ejs');
15
-
16
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
17
- function _interopNamespaceDefault(e) {
18
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
19
- if (e) {
20
- for (const k in e) {
21
- if (k !== 'default') {
22
- const d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: () => e[k]
26
- });
27
- }
28
- }
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
29
16
  }
30
- n.default = e;
31
- return Object.freeze(n);
32
- }
33
-
34
- const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
35
- const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
36
-
37
- const dirname$1 = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
38
- const target = {
39
- entries: [],
40
- html: ""
17
+ return to;
41
18
  };
42
- const excludes = ["tpl", "_", "dist", "node_modules", "__tests__"];
43
- const walk = (dir, playDir) => {
44
- const { cwd, workspace } = devShared.Locals.impl();
45
- const directory = path__namespace.join(cwd, workspace, dir);
46
- fs__namespace.readdirSync(directory).forEach((file) => {
47
- const fullpath = path__namespace.join(directory, file);
48
- const paths = fullpath.split("/") || [];
49
- const stat = fs__namespace.statSync(fullpath);
50
- const extname = path__namespace.extname(fullpath);
51
- if (stat.isFile() && /\.((t|j)sx?|vue|html)$/.test(extname) && paths.length >= 2 && playDir.includes(paths[paths.length - 2])) {
52
- const basename = path__namespace.basename(file, extname);
53
- const name = path__namespace.join(dir, basename).split("/");
54
- playDir.length === 1 && name.splice(name.length - 2, 1);
55
- const name$ = name.join("/");
56
- if (!target.entries.includes(name$)) {
57
- target.entries.push(name$);
58
- }
59
- } else if (stat.isDirectory() && !excludes.includes(file)) {
60
- const subdir = path__namespace.join(dir, file);
61
- walk(subdir, playDir);
62
- }
63
- });
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let node_path = require("node:path");
25
+ node_path = __toESM(node_path);
26
+ let node_url = require("node:url");
27
+ let _deot_dev_shared = require("@deot/dev-shared");
28
+ let fs_extra = require("fs-extra");
29
+ fs_extra = __toESM(fs_extra);
30
+ let vite = require("vite");
31
+ let chalk = require("chalk");
32
+ chalk = __toESM(chalk);
33
+ let _deot_dev_vue = require("@deot/dev-vue");
34
+ _deot_dev_vue = __toESM(_deot_dev_vue);
35
+ let _deot_dev_react = require("@deot/dev-react");
36
+ _deot_dev_react = __toESM(_deot_dev_react);
37
+ let node_fs = require("node:fs");
38
+ node_fs = __toESM(node_fs);
39
+ let ejs = require("ejs");
40
+ ejs = __toESM(ejs);
41
+ //#region packages/dever/src/entries.ts
42
+ var dirname$1 = node_path.dirname((0, node_url.fileURLToPath)({}.url));
43
+ var target = {
44
+ entries: [],
45
+ html: ""
64
46
  };
65
- const get = (playDir) => {
66
- if (target.html) return target;
67
- walk(".", playDir.split(","));
68
- const tpl = fs__namespace.readFileSync(path__namespace.resolve(dirname$1, "../index.ejs"));
69
- target.html = ejs.render(tpl.toString(), {
70
- title: "demo",
71
- base: "/",
72
- pages: target.entries
73
- });
74
- return target;
47
+ var excludes = [
48
+ "tpl",
49
+ "_",
50
+ "dist",
51
+ "node_modules",
52
+ "__tests__"
53
+ ];
54
+ var walk = (dir, playDir) => {
55
+ const { cwd, workspace } = _deot_dev_shared.Locals.impl();
56
+ const directory = node_path.join(cwd, workspace, dir);
57
+ node_fs.readdirSync(directory).forEach((file) => {
58
+ const fullpath = node_path.join(directory, file);
59
+ const paths = fullpath.split("/") || [];
60
+ const stat = node_fs.statSync(fullpath);
61
+ const extname = node_path.extname(fullpath);
62
+ if (stat.isFile() && /\.((t|j)sx?|vue|html)$/.test(extname) && paths.length >= 2 && playDir.includes(paths[paths.length - 2])) {
63
+ const basename = node_path.basename(file, extname);
64
+ const name = node_path.join(dir, basename).split("/");
65
+ playDir.length === 1 && name.splice(name.length - 2, 1);
66
+ const name$ = name.join("/");
67
+ if (!target.entries.includes(name$)) target.entries.push(name$);
68
+ } else if (stat.isDirectory() && !excludes.includes(file)) walk(node_path.join(dir, file), playDir);
69
+ });
75
70
  };
76
-
77
- const dirname = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
78
- const run = (options) => devShared.Utils.autoCatch(async () => {
79
- const locals = devShared.Locals.impl();
80
- options.packageName = devShared.Locals.getRealPackageName(options.packageName);
81
- options.vuePackage = devShared.Locals.getRealPackageName(options.vuePackage);
82
- options.reactPackage = devShared.Locals.getRealPackageName(options.reactPackage);
83
- if (typeof options.dryRun === "undefined") {
84
- options.dryRun = process.env.NODE_ENV === "UNIT";
85
- }
86
- if (options.dryRun) return devShared.Shell.spawn(`echo development`);
87
- const { cwd, workspace, packageOptionsMap, packageDirsMap, subpackagesMap } = locals;
88
- const packageFolderName = devShared.Locals.getPackageFolderName(options.packageName);
89
- const packageOptions = packageOptionsMap[packageFolderName];
90
- const packageDir = packageDirsMap[packageFolderName];
91
- options.watch = true;
92
- if (workspace && cwd !== packageDir && packageOptions?.scripts?.["dev"]) {
93
- await devShared.Shell.spawn(`npm`, ["run", "dev"], { cwd: packageDir });
94
- return;
95
- }
96
- if (!options.packageFolderName) delete options.packageFolderName;
97
- if (!options.workspace) delete options.workspace;
98
- delete options.packageName;
99
- const { entries, html } = get(options.playDir);
100
- if (!entries.length) return devShared.Shell.spawn(`echo no entry file found!`);
101
- let options$ = {
102
- server: {
103
- host: true
104
- }
105
- };
106
- const devOptions = {
107
- ...options,
108
- workspace,
109
- entries,
110
- html,
111
- subpackagesMap,
112
- // 这个是给外部调用(z.)?dev.config.ts用的
113
- useVue: false,
114
- useReact: false
115
- };
116
- const { vuePackage: isVuePackage, reactPackage: isReactPackage } = options;
117
- devOptions.useVue = !!isVuePackage;
118
- devOptions.useReact = !!isReactPackage;
119
- if (fs$1.existsSync(`${cwd}/z.dev.config.ts`)) {
120
- options$.configFile = path__namespace.relative(cwd, path__namespace.resolve(cwd, "./z.dev.config.ts"));
121
- } else if (fs$1.existsSync(`${cwd}/dev.config.ts`)) {
122
- options$.configFile = path__namespace.relative(cwd, path__namespace.resolve(cwd, "./dev.config.ts"));
123
- } else {
124
- process.env.USE_VUE = isVuePackage ? "1" : "";
125
- process.env.USE_REACT = isReactPackage ? "1" : "";
126
- options$.configFile = path__namespace.relative(cwd, path__namespace.resolve(dirname, "../shared.config.ts"));
127
- if (isVuePackage) {
128
- options$ = vite.mergeConfig(sharedVueConfig, options$);
129
- }
130
- if (isReactPackage) {
131
- options$ = vite.mergeConfig(sharedReactConfig, options$);
132
- }
133
- }
134
- process.env.DEV_OPTIONS = encodeURIComponent(JSON.stringify(devOptions));
135
- const server = await vite.createServer(options$);
136
- await server.listen();
137
- const { local = [], network = [] } = server.resolvedUrls || {};
138
- const url = network[0] || local[0] || `http://localhost:${server.config.server.port}`;
139
- entries.forEach((item) => devShared.Logger.log(` > ${item}: ${chalk.cyan(`${url}${item}.html`)}`));
140
- server.printUrls();
141
- server.bindCLIShortcuts({ print: true });
71
+ var get = (playDir) => {
72
+ if (target.html) return target;
73
+ walk(".", playDir.split(","));
74
+ const tpl = node_fs.readFileSync(node_path.resolve(dirname$1, "../index.ejs"));
75
+ target.html = ejs.default.render(tpl.toString(), {
76
+ title: "demo",
77
+ base: "/",
78
+ pages: target.entries
79
+ });
80
+ return target;
81
+ };
82
+ //#endregion
83
+ //#region packages/dever/src/index.ts
84
+ var dirname = node_path.dirname((0, node_url.fileURLToPath)({}.url));
85
+ var run = (options) => _deot_dev_shared.Utils.autoCatch(async () => {
86
+ const locals = _deot_dev_shared.Locals.impl();
87
+ options.packageName = _deot_dev_shared.Locals.getRealPackageName(options.packageName);
88
+ options.vuePackage = _deot_dev_shared.Locals.getRealPackageName(options.vuePackage);
89
+ options.reactPackage = _deot_dev_shared.Locals.getRealPackageName(options.reactPackage);
90
+ if (typeof options.dryRun === "undefined") options.dryRun = process.env.NODE_ENV === "UNIT";
91
+ if (options.dryRun) return _deot_dev_shared.Shell.spawn(`echo development`);
92
+ const { cwd, workspace, packageOptionsMap, packageDirsMap, subpackagesMap } = locals;
93
+ const packageFolderName = _deot_dev_shared.Locals.getPackageFolderName(options.packageName);
94
+ const packageOptions = packageOptionsMap[packageFolderName];
95
+ const packageDir = packageDirsMap[packageFolderName];
96
+ options.watch = true;
97
+ if (workspace && cwd !== packageDir && packageOptions?.scripts?.["dev"]) {
98
+ await _deot_dev_shared.Shell.spawn(`npm`, ["run", "dev"], { cwd: packageDir });
99
+ return;
100
+ }
101
+ if (!options.packageFolderName) delete options.packageFolderName;
102
+ if (!options.workspace) delete options.workspace;
103
+ delete options.packageName;
104
+ const { entries, html } = get(options.playDir);
105
+ if (!entries.length) return _deot_dev_shared.Shell.spawn(`echo no entry file found!`);
106
+ let options$ = { server: { host: true } };
107
+ const devOptions = {
108
+ ...options,
109
+ workspace,
110
+ entries,
111
+ html,
112
+ subpackagesMap,
113
+ useVue: false,
114
+ useReact: false
115
+ };
116
+ const { vuePackage: isVuePackage, reactPackage: isReactPackage } = options;
117
+ devOptions.useVue = !!isVuePackage;
118
+ devOptions.useReact = !!isReactPackage;
119
+ if (fs_extra.default.existsSync(`${cwd}/z.dev.config.ts`)) options$.configFile = node_path.relative(cwd, node_path.resolve(cwd, "./z.dev.config.ts"));
120
+ else if (fs_extra.default.existsSync(`${cwd}/dev.config.ts`)) options$.configFile = node_path.relative(cwd, node_path.resolve(cwd, "./dev.config.ts"));
121
+ else {
122
+ process.env.USE_VUE = isVuePackage ? "1" : "";
123
+ process.env.USE_REACT = isReactPackage ? "1" : "";
124
+ options$.configFile = node_path.relative(cwd, node_path.resolve(dirname, "../shared.config.ts"));
125
+ if (isVuePackage) options$ = (0, vite.mergeConfig)(_deot_dev_vue.default, options$);
126
+ if (isReactPackage) options$ = (0, vite.mergeConfig)(_deot_dev_react.default, options$);
127
+ }
128
+ process.env.DEV_OPTIONS = encodeURIComponent(JSON.stringify(devOptions));
129
+ const server = await (0, vite.createServer)(options$);
130
+ await server.listen();
131
+ const { local = [], network = [] } = server.resolvedUrls || {};
132
+ const url = network[0] || local[0] || `http://localhost:${server.config.server.port}`;
133
+ entries.forEach((item) => _deot_dev_shared.Logger.log(` > ${item}: ${chalk.default.cyan(`${url}${item}.html`)}`));
134
+ server.printUrls();
135
+ server.bindCLIShortcuts({ print: true });
142
136
  });
143
-
137
+ //#endregion
144
138
  exports.run = run;
package/dist/index.js CHANGED
@@ -1,119 +1,108 @@
1
- import * as path from 'node:path';
2
- import { fileURLToPath } from 'node:url';
3
- import { Locals, Utils, Shell, Logger } from '@deot/dev-shared';
4
- import fs$1 from 'fs-extra';
5
- import { mergeConfig, createServer } from 'vite';
6
- import chalk from 'chalk';
7
- import sharedVueConfig from '@deot/dev-vue';
8
- import sharedReactConfig from '@deot/dev-react';
9
- import * as fs from 'node:fs';
10
- import { render } from 'ejs';
11
-
12
- const dirname$1 = path.dirname(fileURLToPath(import.meta.url));
13
- const target = {
14
- entries: [],
15
- html: ""
1
+ import * as path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { Locals, Logger, Shell, Utils } from "@deot/dev-shared";
4
+ import fs from "fs-extra";
5
+ import { createServer, mergeConfig } from "vite";
6
+ import chalk from "chalk";
7
+ import sharedVueConfig from "@deot/dev-vue";
8
+ import sharedReactConfig from "@deot/dev-react";
9
+ import * as fs$1 from "node:fs";
10
+ import ejs from "ejs";
11
+ //#region packages/dever/src/entries.ts
12
+ var dirname$1 = path.dirname(fileURLToPath(import.meta.url));
13
+ var target = {
14
+ entries: [],
15
+ html: ""
16
16
  };
17
- const excludes = ["tpl", "_", "dist", "node_modules", "__tests__"];
18
- const walk = (dir, playDir) => {
19
- const { cwd, workspace } = Locals.impl();
20
- const directory = path.join(cwd, workspace, dir);
21
- fs.readdirSync(directory).forEach((file) => {
22
- const fullpath = path.join(directory, file);
23
- const paths = fullpath.split("/") || [];
24
- const stat = fs.statSync(fullpath);
25
- const extname = path.extname(fullpath);
26
- if (stat.isFile() && /\.((t|j)sx?|vue|html)$/.test(extname) && paths.length >= 2 && playDir.includes(paths[paths.length - 2])) {
27
- const basename = path.basename(file, extname);
28
- const name = path.join(dir, basename).split("/");
29
- playDir.length === 1 && name.splice(name.length - 2, 1);
30
- const name$ = name.join("/");
31
- if (!target.entries.includes(name$)) {
32
- target.entries.push(name$);
33
- }
34
- } else if (stat.isDirectory() && !excludes.includes(file)) {
35
- const subdir = path.join(dir, file);
36
- walk(subdir, playDir);
37
- }
38
- });
17
+ var excludes = [
18
+ "tpl",
19
+ "_",
20
+ "dist",
21
+ "node_modules",
22
+ "__tests__"
23
+ ];
24
+ var walk = (dir, playDir) => {
25
+ const { cwd, workspace } = Locals.impl();
26
+ const directory = path.join(cwd, workspace, dir);
27
+ fs$1.readdirSync(directory).forEach((file) => {
28
+ const fullpath = path.join(directory, file);
29
+ const paths = fullpath.split("/") || [];
30
+ const stat = fs$1.statSync(fullpath);
31
+ const extname = path.extname(fullpath);
32
+ if (stat.isFile() && /\.((t|j)sx?|vue|html)$/.test(extname) && paths.length >= 2 && playDir.includes(paths[paths.length - 2])) {
33
+ const basename = path.basename(file, extname);
34
+ const name = path.join(dir, basename).split("/");
35
+ playDir.length === 1 && name.splice(name.length - 2, 1);
36
+ const name$ = name.join("/");
37
+ if (!target.entries.includes(name$)) target.entries.push(name$);
38
+ } else if (stat.isDirectory() && !excludes.includes(file)) walk(path.join(dir, file), playDir);
39
+ });
39
40
  };
40
- const get = (playDir) => {
41
- if (target.html) return target;
42
- walk(".", playDir.split(","));
43
- const tpl = fs.readFileSync(path.resolve(dirname$1, "../index.ejs"));
44
- target.html = render(tpl.toString(), {
45
- title: "demo",
46
- base: "/",
47
- pages: target.entries
48
- });
49
- return target;
41
+ var get = (playDir) => {
42
+ if (target.html) return target;
43
+ walk(".", playDir.split(","));
44
+ const tpl = fs$1.readFileSync(path.resolve(dirname$1, "../index.ejs"));
45
+ target.html = ejs.render(tpl.toString(), {
46
+ title: "demo",
47
+ base: "/",
48
+ pages: target.entries
49
+ });
50
+ return target;
50
51
  };
51
-
52
- const dirname = path.dirname(fileURLToPath(import.meta.url));
53
- const run = (options) => Utils.autoCatch(async () => {
54
- const locals = Locals.impl();
55
- options.packageName = Locals.getRealPackageName(options.packageName);
56
- options.vuePackage = Locals.getRealPackageName(options.vuePackage);
57
- options.reactPackage = Locals.getRealPackageName(options.reactPackage);
58
- if (typeof options.dryRun === "undefined") {
59
- options.dryRun = process.env.NODE_ENV === "UNIT";
60
- }
61
- if (options.dryRun) return Shell.spawn(`echo development`);
62
- const { cwd, workspace, packageOptionsMap, packageDirsMap, subpackagesMap } = locals;
63
- const packageFolderName = Locals.getPackageFolderName(options.packageName);
64
- const packageOptions = packageOptionsMap[packageFolderName];
65
- const packageDir = packageDirsMap[packageFolderName];
66
- options.watch = true;
67
- if (workspace && cwd !== packageDir && packageOptions?.scripts?.["dev"]) {
68
- await Shell.spawn(`npm`, ["run", "dev"], { cwd: packageDir });
69
- return;
70
- }
71
- if (!options.packageFolderName) delete options.packageFolderName;
72
- if (!options.workspace) delete options.workspace;
73
- delete options.packageName;
74
- const { entries, html } = get(options.playDir);
75
- if (!entries.length) return Shell.spawn(`echo no entry file found!`);
76
- let options$ = {
77
- server: {
78
- host: true
79
- }
80
- };
81
- const devOptions = {
82
- ...options,
83
- workspace,
84
- entries,
85
- html,
86
- subpackagesMap,
87
- // 这个是给外部调用(z.)?dev.config.ts用的
88
- useVue: false,
89
- useReact: false
90
- };
91
- const { vuePackage: isVuePackage, reactPackage: isReactPackage } = options;
92
- devOptions.useVue = !!isVuePackage;
93
- devOptions.useReact = !!isReactPackage;
94
- if (fs$1.existsSync(`${cwd}/z.dev.config.ts`)) {
95
- options$.configFile = path.relative(cwd, path.resolve(cwd, "./z.dev.config.ts"));
96
- } else if (fs$1.existsSync(`${cwd}/dev.config.ts`)) {
97
- options$.configFile = path.relative(cwd, path.resolve(cwd, "./dev.config.ts"));
98
- } else {
99
- process.env.USE_VUE = isVuePackage ? "1" : "";
100
- process.env.USE_REACT = isReactPackage ? "1" : "";
101
- options$.configFile = path.relative(cwd, path.resolve(dirname, "../shared.config.ts"));
102
- if (isVuePackage) {
103
- options$ = mergeConfig(sharedVueConfig, options$);
104
- }
105
- if (isReactPackage) {
106
- options$ = mergeConfig(sharedReactConfig, options$);
107
- }
108
- }
109
- process.env.DEV_OPTIONS = encodeURIComponent(JSON.stringify(devOptions));
110
- const server = await createServer(options$);
111
- await server.listen();
112
- const { local = [], network = [] } = server.resolvedUrls || {};
113
- const url = network[0] || local[0] || `http://localhost:${server.config.server.port}`;
114
- entries.forEach((item) => Logger.log(` > ${item}: ${chalk.cyan(`${url}${item}.html`)}`));
115
- server.printUrls();
116
- server.bindCLIShortcuts({ print: true });
52
+ //#endregion
53
+ //#region packages/dever/src/index.ts
54
+ var dirname = path.dirname(fileURLToPath(import.meta.url));
55
+ var run = (options) => Utils.autoCatch(async () => {
56
+ const locals = Locals.impl();
57
+ options.packageName = Locals.getRealPackageName(options.packageName);
58
+ options.vuePackage = Locals.getRealPackageName(options.vuePackage);
59
+ options.reactPackage = Locals.getRealPackageName(options.reactPackage);
60
+ if (typeof options.dryRun === "undefined") options.dryRun = process.env.NODE_ENV === "UNIT";
61
+ if (options.dryRun) return Shell.spawn(`echo development`);
62
+ const { cwd, workspace, packageOptionsMap, packageDirsMap, subpackagesMap } = locals;
63
+ const packageFolderName = Locals.getPackageFolderName(options.packageName);
64
+ const packageOptions = packageOptionsMap[packageFolderName];
65
+ const packageDir = packageDirsMap[packageFolderName];
66
+ options.watch = true;
67
+ if (workspace && cwd !== packageDir && packageOptions?.scripts?.["dev"]) {
68
+ await Shell.spawn(`npm`, ["run", "dev"], { cwd: packageDir });
69
+ return;
70
+ }
71
+ if (!options.packageFolderName) delete options.packageFolderName;
72
+ if (!options.workspace) delete options.workspace;
73
+ delete options.packageName;
74
+ const { entries, html } = get(options.playDir);
75
+ if (!entries.length) return Shell.spawn(`echo no entry file found!`);
76
+ let options$ = { server: { host: true } };
77
+ const devOptions = {
78
+ ...options,
79
+ workspace,
80
+ entries,
81
+ html,
82
+ subpackagesMap,
83
+ useVue: false,
84
+ useReact: false
85
+ };
86
+ const { vuePackage: isVuePackage, reactPackage: isReactPackage } = options;
87
+ devOptions.useVue = !!isVuePackage;
88
+ devOptions.useReact = !!isReactPackage;
89
+ if (fs.existsSync(`${cwd}/z.dev.config.ts`)) options$.configFile = path.relative(cwd, path.resolve(cwd, "./z.dev.config.ts"));
90
+ else if (fs.existsSync(`${cwd}/dev.config.ts`)) options$.configFile = path.relative(cwd, path.resolve(cwd, "./dev.config.ts"));
91
+ else {
92
+ process.env.USE_VUE = isVuePackage ? "1" : "";
93
+ process.env.USE_REACT = isReactPackage ? "1" : "";
94
+ options$.configFile = path.relative(cwd, path.resolve(dirname, "../shared.config.ts"));
95
+ if (isVuePackage) options$ = mergeConfig(sharedVueConfig, options$);
96
+ if (isReactPackage) options$ = mergeConfig(sharedReactConfig, options$);
97
+ }
98
+ process.env.DEV_OPTIONS = encodeURIComponent(JSON.stringify(devOptions));
99
+ const server = await createServer(options$);
100
+ await server.listen();
101
+ const { local = [], network = [] } = server.resolvedUrls || {};
102
+ const url = network[0] || local[0] || `http://localhost:${server.config.server.port}`;
103
+ entries.forEach((item) => Logger.log(` > ${item}: ${chalk.cyan(`${url}${item}.html`)}`));
104
+ server.printUrls();
105
+ server.bindCLIShortcuts({ print: true });
117
106
  });
118
-
107
+ //#endregion
119
108
  export { run };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/dev-dever",
3
- "version": "2.9.9",
3
+ "version": "2.9.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,14 +21,14 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
- "@deot/dev-react": "^2.9.9",
25
- "@deot/dev-shared": "^2.9.9",
26
- "@deot/dev-vue": "^2.9.9",
27
- "ejs": "^3.1.10",
28
- "vite": "^7.3.1"
24
+ "@deot/dev-react": "^2.9.10",
25
+ "@deot/dev-shared": "^2.9.10",
26
+ "@deot/dev-vue": "^2.9.10",
27
+ "ejs": "^5.0.1",
28
+ "vite": "^8.0.5"
29
29
  },
30
30
  "devDependencies": {
31
- "@deot/dev-test": "^2.9.9",
31
+ "@deot/dev-test": "^2.9.10",
32
32
  "cross-env": "^10.1.0"
33
33
  }
34
34
  }