@deot/dev-dever 2.5.4 → 2.6.0
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/README.md +8 -1
- package/dist/index.cjs +3 -2
- package/package.json +8 -8
- package/shared.config.ts +10 -3
- /package/dist/{index.es.js → index.js} +0 -0
package/README.md
CHANGED
|
@@ -40,4 +40,11 @@ export default mergeConfig(
|
|
|
40
40
|
|
|
41
41
|
## 预加载配置`preload.ts`
|
|
42
42
|
|
|
43
|
-
会查找当前文件夹路径下往前查找`preload.ts`文件,直至`process.cwd()`,如果存件,就近添加`preload.ts`
|
|
43
|
+
会查找当前文件夹路径下往前查找`preload.ts`文件,直至`process.cwd()`,如果存件,就近添加`preload.ts`
|
|
44
|
+
|
|
45
|
+
文件查找优先级
|
|
46
|
+
|
|
47
|
+
- `z.dev.preload.ts`
|
|
48
|
+
- `dev.preload.ts`
|
|
49
|
+
- `z.preload.ts`
|
|
50
|
+
- `preload.ts`
|
package/dist/index.cjs
CHANGED
|
@@ -13,6 +13,7 @@ const sharedReactConfig = require('@deot/dev-react');
|
|
|
13
13
|
const fs = require('node:fs');
|
|
14
14
|
const ejs = require('ejs');
|
|
15
15
|
|
|
16
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
16
17
|
function _interopNamespaceDefault(e) {
|
|
17
18
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
18
19
|
if (e) {
|
|
@@ -33,7 +34,7 @@ function _interopNamespaceDefault(e) {
|
|
|
33
34
|
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
34
35
|
const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
35
36
|
|
|
36
|
-
const dirname$1 = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (
|
|
37
|
+
const dirname$1 = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
37
38
|
let target = {
|
|
38
39
|
entries: [],
|
|
39
40
|
html: ""
|
|
@@ -72,7 +73,7 @@ const get = () => {
|
|
|
72
73
|
return target;
|
|
73
74
|
};
|
|
74
75
|
|
|
75
|
-
const dirname = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (
|
|
76
|
+
const dirname = path__namespace.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
76
77
|
const run = (options) => devShared.Utils.autoCatch(async () => {
|
|
77
78
|
const locals = devShared.Locals.impl();
|
|
78
79
|
if (typeof options.dryRun === "undefined") {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/dev-dever",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "dist/index.
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"import": "./dist/index.
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
10
|
"require": "./dist/index.cjs",
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
}
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@deot/dev-react": "^2.
|
|
25
|
-
"@deot/dev-shared": "^2.
|
|
26
|
-
"@deot/dev-vue": "^2.
|
|
24
|
+
"@deot/dev-react": "^2.6.0",
|
|
25
|
+
"@deot/dev-shared": "^2.6.0",
|
|
26
|
+
"@deot/dev-vue": "^2.6.0",
|
|
27
27
|
"ejs": "^3.1.9",
|
|
28
|
-
"vite": "^4.
|
|
28
|
+
"vite": "^4.5.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@deot/dev-test": "^2.
|
|
31
|
+
"@deot/dev-test": "^2.6.0",
|
|
32
32
|
"cross-env": "^7.0.3"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/shared.config.ts
CHANGED
|
@@ -62,9 +62,16 @@ const getVirtualHtml = async (url: string) => {
|
|
|
62
62
|
const getPreload = (fullpath: string) => {
|
|
63
63
|
let dir$ = path.dirname(fullpath);
|
|
64
64
|
let preload = '';
|
|
65
|
-
while (dir
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
while (dir$.includes(cwd) && !preload) {
|
|
66
|
+
|
|
67
|
+
let preloadFullPath = [
|
|
68
|
+
path.resolve(dir$, './z.dev.preload.ts'),
|
|
69
|
+
path.resolve(dir$, './dev.preload.ts'),
|
|
70
|
+
path.resolve(dir$, './z.preload.ts'),
|
|
71
|
+
path.resolve(dir$, './preload.ts')
|
|
72
|
+
].find(i => fs.existsSync(i));
|
|
73
|
+
|
|
74
|
+
if (preloadFullPath) {
|
|
68
75
|
preload = ` import "/${path.relative(cwd, preloadFullPath)}";\n`;
|
|
69
76
|
} else {
|
|
70
77
|
dir$ = path.resolve(dir$, '..');
|
|
File without changes
|