@vtj/local 0.12.19 → 0.12.21
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.cjs +87 -0
- package/dist/index.d.cts +10 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +87 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
const vite = require('vite');
|
3
4
|
const cli = require('@vtj/cli');
|
4
5
|
const node = require('@vtj/node');
|
5
6
|
const path = require('path');
|
@@ -541,6 +542,17 @@ async function saveLogs(e) {
|
|
541
542
|
async function getExtension(_body, opts) {
|
542
543
|
const root = path.resolve("./");
|
543
544
|
const pkg = node.readJsonSync(path.resolve(root, "package.json"));
|
545
|
+
const { name = "VTJEnhance", outDir = "enhance" } = typeof opts.enhance === "boolean" ? {} : opts.enhance || {};
|
546
|
+
const outputDir = `${opts.nodeModulesDir}/${opts.packageName}/dist/${outDir}`;
|
547
|
+
const enhance = {
|
548
|
+
name,
|
549
|
+
urls: []
|
550
|
+
};
|
551
|
+
const enhanceDir = path.resolve(root, outputDir);
|
552
|
+
if (node.pathExistsSync(enhanceDir)) {
|
553
|
+
const files = node.readdirSync(enhanceDir) || [];
|
554
|
+
enhance.urls = files.map((n) => `${outDir}/${n}`);
|
555
|
+
}
|
544
556
|
const { vtj = {} } = pkg || {};
|
545
557
|
const __ACCESS__ = {
|
546
558
|
auth: "https://lcdp.vtj.pro/auth.html",
|
@@ -549,6 +561,7 @@ async function getExtension(_body, opts) {
|
|
549
561
|
};
|
550
562
|
const config = {
|
551
563
|
remote: "https://lcdp.vtj.pro",
|
564
|
+
enhance,
|
552
565
|
...vtj,
|
553
566
|
history: vtj.history || "hash",
|
554
567
|
base: vtj.base || "/",
|
@@ -1124,6 +1137,76 @@ const aliasPlugin = function(options) {
|
|
1124
1137
|
}
|
1125
1138
|
};
|
1126
1139
|
};
|
1140
|
+
const umdBuildPlugin = function(options) {
|
1141
|
+
const {
|
1142
|
+
entry = "src/enhance.ts",
|
1143
|
+
name = "VTJEnhance",
|
1144
|
+
fileName = "enhance",
|
1145
|
+
external = [],
|
1146
|
+
globals = {},
|
1147
|
+
outDir = "enhance"
|
1148
|
+
} = typeof options.enhance === "boolean" ? {} : options.enhance || {};
|
1149
|
+
const outputDir = `${options.nodeModulesDir}/${options.packageName}/dist/${outDir}`;
|
1150
|
+
return {
|
1151
|
+
name: "vtj-umd-build-plugin",
|
1152
|
+
configureServer(server) {
|
1153
|
+
const buildUmd = async () => {
|
1154
|
+
await vite.build({
|
1155
|
+
configFile: false,
|
1156
|
+
mode: "production",
|
1157
|
+
define: {
|
1158
|
+
"process.env.NODE_ENV": JSON.stringify("production")
|
1159
|
+
},
|
1160
|
+
build: {
|
1161
|
+
outDir: outputDir,
|
1162
|
+
emptyOutDir: false,
|
1163
|
+
copyPublicDir: false,
|
1164
|
+
lib: {
|
1165
|
+
entry,
|
1166
|
+
name,
|
1167
|
+
formats: ["umd"],
|
1168
|
+
cssFileName: fileName,
|
1169
|
+
fileName: () => {
|
1170
|
+
return `${fileName}.umd.js`;
|
1171
|
+
}
|
1172
|
+
},
|
1173
|
+
watch: {},
|
1174
|
+
minify: true,
|
1175
|
+
rollupOptions: {
|
1176
|
+
external: [
|
1177
|
+
"vue",
|
1178
|
+
"vue-router",
|
1179
|
+
"@vtj/icons",
|
1180
|
+
"@vtj/utils",
|
1181
|
+
"uni-app",
|
1182
|
+
"uni-h5",
|
1183
|
+
...external
|
1184
|
+
],
|
1185
|
+
output: {
|
1186
|
+
exports: "auto",
|
1187
|
+
globals: {
|
1188
|
+
vue: "Vue",
|
1189
|
+
"vue-router": "VueRouter",
|
1190
|
+
"@vtj/icons": "VtjIcons",
|
1191
|
+
"@vtj/utils": "VtjUtils",
|
1192
|
+
"uni-app": "UniApp",
|
1193
|
+
"uni-h5": "UniH5",
|
1194
|
+
...globals
|
1195
|
+
}
|
1196
|
+
}
|
1197
|
+
}
|
1198
|
+
}
|
1199
|
+
});
|
1200
|
+
};
|
1201
|
+
buildUmd();
|
1202
|
+
server.watcher.on("change", async (path) => {
|
1203
|
+
if (path.endsWith("src/enhance.ts")) {
|
1204
|
+
await buildUmd();
|
1205
|
+
}
|
1206
|
+
});
|
1207
|
+
}
|
1208
|
+
};
|
1209
|
+
};
|
1127
1210
|
function parsePresetPlugins(options) {
|
1128
1211
|
const {
|
1129
1212
|
presetPlugins = [],
|
@@ -1176,6 +1259,7 @@ function createDevTools(options = {}) {
|
|
1176
1259
|
extensionDir: "",
|
1177
1260
|
materialDirs: [],
|
1178
1261
|
hm: "42f2469b4aa27c3f8978f634c0c19d24",
|
1262
|
+
enhance: false,
|
1179
1263
|
...options
|
1180
1264
|
};
|
1181
1265
|
const plugins = [aliasPlugin(opts)];
|
@@ -1277,6 +1361,9 @@ function createDevTools(options = {}) {
|
|
1277
1361
|
if (opts.hm) {
|
1278
1362
|
plugins.push(hmPlugin(opts));
|
1279
1363
|
}
|
1364
|
+
if (opts.enhance) {
|
1365
|
+
plugins.push(umdBuildPlugin(opts));
|
1366
|
+
}
|
1280
1367
|
return plugins;
|
1281
1368
|
}
|
1282
1369
|
|
package/dist/index.d.cts
CHANGED
@@ -20,6 +20,15 @@ interface DevToolsOptions {
|
|
20
20
|
extensionDir: string;
|
21
21
|
materialDirs: string[];
|
22
22
|
hm?: string;
|
23
|
+
enhance?: boolean | EnhanceOptions;
|
24
|
+
}
|
25
|
+
interface EnhanceOptions {
|
26
|
+
entry?: string;
|
27
|
+
name?: string;
|
28
|
+
fileName?: string;
|
29
|
+
external?: string[];
|
30
|
+
globals?: Record<string, string>;
|
31
|
+
outDir?: string;
|
23
32
|
}
|
24
33
|
interface LinkOptions {
|
25
34
|
entry?: string;
|
@@ -33,4 +42,4 @@ declare function parsePresetPlugins(options: DevToolsOptions): {
|
|
33
42
|
declare function createDevTools(options?: Partial<DevToolsOptions>): Plugin<any>[];
|
34
43
|
|
35
44
|
export { createDevTools, parsePresetPlugins };
|
36
|
-
export type { DevToolsOptions, LinkOptions };
|
45
|
+
export type { DevToolsOptions, EnhanceOptions, LinkOptions };
|
package/dist/index.d.mts
CHANGED
@@ -20,6 +20,15 @@ interface DevToolsOptions {
|
|
20
20
|
extensionDir: string;
|
21
21
|
materialDirs: string[];
|
22
22
|
hm?: string;
|
23
|
+
enhance?: boolean | EnhanceOptions;
|
24
|
+
}
|
25
|
+
interface EnhanceOptions {
|
26
|
+
entry?: string;
|
27
|
+
name?: string;
|
28
|
+
fileName?: string;
|
29
|
+
external?: string[];
|
30
|
+
globals?: Record<string, string>;
|
31
|
+
outDir?: string;
|
23
32
|
}
|
24
33
|
interface LinkOptions {
|
25
34
|
entry?: string;
|
@@ -33,4 +42,4 @@ declare function parsePresetPlugins(options: DevToolsOptions): {
|
|
33
42
|
declare function createDevTools(options?: Partial<DevToolsOptions>): Plugin<any>[];
|
34
43
|
|
35
44
|
export { createDevTools, parsePresetPlugins };
|
36
|
-
export type { DevToolsOptions, LinkOptions };
|
45
|
+
export type { DevToolsOptions, EnhanceOptions, LinkOptions };
|
package/dist/index.d.ts
CHANGED
@@ -20,6 +20,15 @@ interface DevToolsOptions {
|
|
20
20
|
extensionDir: string;
|
21
21
|
materialDirs: string[];
|
22
22
|
hm?: string;
|
23
|
+
enhance?: boolean | EnhanceOptions;
|
24
|
+
}
|
25
|
+
interface EnhanceOptions {
|
26
|
+
entry?: string;
|
27
|
+
name?: string;
|
28
|
+
fileName?: string;
|
29
|
+
external?: string[];
|
30
|
+
globals?: Record<string, string>;
|
31
|
+
outDir?: string;
|
23
32
|
}
|
24
33
|
interface LinkOptions {
|
25
34
|
entry?: string;
|
@@ -33,4 +42,4 @@ declare function parsePresetPlugins(options: DevToolsOptions): {
|
|
33
42
|
declare function createDevTools(options?: Partial<DevToolsOptions>): Plugin<any>[];
|
34
43
|
|
35
44
|
export { createDevTools, parsePresetPlugins };
|
36
|
-
export type { DevToolsOptions, LinkOptions };
|
45
|
+
export type { DevToolsOptions, EnhanceOptions, LinkOptions };
|
package/dist/index.mjs
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { build } from 'vite';
|
1
2
|
import { copyPlugin, staticPlugin } from '@vtj/cli';
|
2
3
|
import { pathExistsSync, ensureFileSync, writeJsonSync, readJsonSync, removeSync, outputFileSync, readdirSync, moveSync, upperFirstCamelCase, camelCase, fs, timestamp, uuid } from '@vtj/node';
|
3
4
|
import { resolve, join } from 'path';
|
@@ -534,6 +535,17 @@ async function saveLogs(e) {
|
|
534
535
|
async function getExtension(_body, opts) {
|
535
536
|
const root = resolve("./");
|
536
537
|
const pkg = readJsonSync(resolve(root, "package.json"));
|
538
|
+
const { name = "VTJEnhance", outDir = "enhance" } = typeof opts.enhance === "boolean" ? {} : opts.enhance || {};
|
539
|
+
const outputDir = `${opts.nodeModulesDir}/${opts.packageName}/dist/${outDir}`;
|
540
|
+
const enhance = {
|
541
|
+
name,
|
542
|
+
urls: []
|
543
|
+
};
|
544
|
+
const enhanceDir = resolve(root, outputDir);
|
545
|
+
if (pathExistsSync(enhanceDir)) {
|
546
|
+
const files = readdirSync(enhanceDir) || [];
|
547
|
+
enhance.urls = files.map((n) => `${outDir}/${n}`);
|
548
|
+
}
|
537
549
|
const { vtj = {} } = pkg || {};
|
538
550
|
const __ACCESS__ = {
|
539
551
|
auth: "https://lcdp.vtj.pro/auth.html",
|
@@ -542,6 +554,7 @@ async function getExtension(_body, opts) {
|
|
542
554
|
};
|
543
555
|
const config = {
|
544
556
|
remote: "https://lcdp.vtj.pro",
|
557
|
+
enhance,
|
545
558
|
...vtj,
|
546
559
|
history: vtj.history || "hash",
|
547
560
|
base: vtj.base || "/",
|
@@ -1117,6 +1130,76 @@ const aliasPlugin = function(options) {
|
|
1117
1130
|
}
|
1118
1131
|
};
|
1119
1132
|
};
|
1133
|
+
const umdBuildPlugin = function(options) {
|
1134
|
+
const {
|
1135
|
+
entry = "src/enhance.ts",
|
1136
|
+
name = "VTJEnhance",
|
1137
|
+
fileName = "enhance",
|
1138
|
+
external = [],
|
1139
|
+
globals = {},
|
1140
|
+
outDir = "enhance"
|
1141
|
+
} = typeof options.enhance === "boolean" ? {} : options.enhance || {};
|
1142
|
+
const outputDir = `${options.nodeModulesDir}/${options.packageName}/dist/${outDir}`;
|
1143
|
+
return {
|
1144
|
+
name: "vtj-umd-build-plugin",
|
1145
|
+
configureServer(server) {
|
1146
|
+
const buildUmd = async () => {
|
1147
|
+
await build({
|
1148
|
+
configFile: false,
|
1149
|
+
mode: "production",
|
1150
|
+
define: {
|
1151
|
+
"process.env.NODE_ENV": JSON.stringify("production")
|
1152
|
+
},
|
1153
|
+
build: {
|
1154
|
+
outDir: outputDir,
|
1155
|
+
emptyOutDir: false,
|
1156
|
+
copyPublicDir: false,
|
1157
|
+
lib: {
|
1158
|
+
entry,
|
1159
|
+
name,
|
1160
|
+
formats: ["umd"],
|
1161
|
+
cssFileName: fileName,
|
1162
|
+
fileName: () => {
|
1163
|
+
return `${fileName}.umd.js`;
|
1164
|
+
}
|
1165
|
+
},
|
1166
|
+
watch: {},
|
1167
|
+
minify: true,
|
1168
|
+
rollupOptions: {
|
1169
|
+
external: [
|
1170
|
+
"vue",
|
1171
|
+
"vue-router",
|
1172
|
+
"@vtj/icons",
|
1173
|
+
"@vtj/utils",
|
1174
|
+
"uni-app",
|
1175
|
+
"uni-h5",
|
1176
|
+
...external
|
1177
|
+
],
|
1178
|
+
output: {
|
1179
|
+
exports: "auto",
|
1180
|
+
globals: {
|
1181
|
+
vue: "Vue",
|
1182
|
+
"vue-router": "VueRouter",
|
1183
|
+
"@vtj/icons": "VtjIcons",
|
1184
|
+
"@vtj/utils": "VtjUtils",
|
1185
|
+
"uni-app": "UniApp",
|
1186
|
+
"uni-h5": "UniH5",
|
1187
|
+
...globals
|
1188
|
+
}
|
1189
|
+
}
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
});
|
1193
|
+
};
|
1194
|
+
buildUmd();
|
1195
|
+
server.watcher.on("change", async (path) => {
|
1196
|
+
if (path.endsWith("src/enhance.ts")) {
|
1197
|
+
await buildUmd();
|
1198
|
+
}
|
1199
|
+
});
|
1200
|
+
}
|
1201
|
+
};
|
1202
|
+
};
|
1120
1203
|
function parsePresetPlugins(options) {
|
1121
1204
|
const {
|
1122
1205
|
presetPlugins = [],
|
@@ -1169,6 +1252,7 @@ function createDevTools(options = {}) {
|
|
1169
1252
|
extensionDir: "",
|
1170
1253
|
materialDirs: [],
|
1171
1254
|
hm: "42f2469b4aa27c3f8978f634c0c19d24",
|
1255
|
+
enhance: false,
|
1172
1256
|
...options
|
1173
1257
|
};
|
1174
1258
|
const plugins = [aliasPlugin(opts)];
|
@@ -1270,6 +1354,9 @@ function createDevTools(options = {}) {
|
|
1270
1354
|
if (opts.hm) {
|
1271
1355
|
plugins.push(hmPlugin(opts));
|
1272
1356
|
}
|
1357
|
+
if (opts.enhance) {
|
1358
|
+
plugins.push(umdBuildPlugin(opts));
|
1359
|
+
}
|
1273
1360
|
return plugins;
|
1274
1361
|
}
|
1275
1362
|
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vtj/local",
|
3
3
|
"private": false,
|
4
|
-
"version": "0.12.
|
4
|
+
"version": "0.12.21",
|
5
5
|
"type": "module",
|
6
6
|
"keywords": [
|
7
7
|
"低代码引擎",
|
@@ -22,10 +22,10 @@
|
|
22
22
|
"license": "MIT",
|
23
23
|
"dependencies": {
|
24
24
|
"formidable": "~3.5.1",
|
25
|
-
"@vtj/coder": "~0.12.
|
26
|
-
"@vtj/core": "~0.12.
|
25
|
+
"@vtj/coder": "~0.12.21",
|
26
|
+
"@vtj/core": "~0.12.21",
|
27
27
|
"@vtj/node": "~0.12.0",
|
28
|
-
"@vtj/parser": "~0.12.
|
28
|
+
"@vtj/parser": "~0.12.21"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"@types/formidable": "~3.4.5",
|