@nasl/cli 0.1.2 → 0.1.4
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 +5 -5
- package/build/index.html +6 -6
- package/build/index.js +21 -17
- package/build/nasl.bundle.js +59104 -8
- package/build/webpack.config.js +74 -45
- package/out/apis/createAxios.d.ts +2 -0
- package/out/apis/createAxios.d.ts.map +1 -0
- package/out/apis/createAxios.js +17 -0
- package/out/apis/createAxios.js.map +1 -0
- package/out/apis/index.d.ts +2 -2
- package/out/apis/index.d.ts.map +1 -1
- package/out/apis/index.js +6 -6
- package/out/apis/index.js.map +1 -1
- package/out/bin/nasl.js +26 -7
- package/out/bin/nasl.js.map +1 -1
- package/out/bin/naslc.js +1 -1
- package/out/bin/naslc.js.map +1 -1
- package/out/commands/build.d.ts +8 -0
- package/out/commands/build.d.ts.map +1 -0
- package/out/commands/build.js +54 -0
- package/out/commands/build.js.map +1 -0
- package/out/commands/check.d.ts +2 -1
- package/out/commands/check.d.ts.map +1 -1
- package/out/commands/check.js +20 -12
- package/out/commands/check.js.map +1 -1
- package/out/commands/compile.d.ts +4 -3
- package/out/commands/compile.d.ts.map +1 -1
- package/out/commands/compile.js +8 -10
- package/out/commands/compile.js.map +1 -1
- package/out/commands/dep.d.ts +1 -1
- package/out/commands/dep.d.ts.map +1 -1
- package/out/commands/dep.js +3 -3
- package/out/commands/dep.js.map +1 -1
- package/out/commands/dev.d.ts +7 -1
- package/out/commands/dev.d.ts.map +1 -1
- package/out/commands/dev.js +14 -4
- package/out/commands/dev.js.map +1 -1
- package/out/commands/index.d.ts +3 -1
- package/out/commands/index.d.ts.map +1 -1
- package/out/commands/index.js +3 -1
- package/out/commands/index.js.map +1 -1
- package/out/commands/init.d.ts +1 -1
- package/out/commands/init.d.ts.map +1 -1
- package/out/commands/init.js +2 -2
- package/out/commands/init.js.map +1 -1
- package/out/index.d.ts +2 -11
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -11
- package/out/index.js.map +1 -1
- package/out/services/compose.d.ts.map +1 -1
- package/out/services/compose.js +29 -2
- package/out/services/compose.js.map +1 -1
- package/out/services/resolve.d.ts +2 -2
- package/out/services/resolve.d.ts.map +1 -1
- package/out/services/resolve.js +35 -30
- package/out/services/resolve.js.map +1 -1
- package/out/types/command.d.ts +4 -0
- package/out/types/command.d.ts.map +1 -0
- package/out/types/command.js +3 -0
- package/out/types/command.js.map +1 -0
- package/out/types/config.js +1 -1
- package/out/types/index.d.ts +1 -0
- package/out/types/index.d.ts.map +1 -1
- package/out/types/index.js +1 -0
- package/out/types/index.js.map +1 -1
- package/out/utils/logger.d.ts +1 -0
- package/out/utils/logger.d.ts.map +1 -1
- package/out/utils/logger.js +51 -0
- package/out/utils/logger.js.map +1 -1
- package/package.json +29 -11
package/build/webpack.config.js
CHANGED
|
@@ -1,59 +1,88 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
3
|
const { VueLoaderPlugin } = require('vue-loader');
|
|
4
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
4
5
|
|
|
5
6
|
const outDir = process.cwd();
|
|
6
7
|
|
|
7
|
-
module.exports = {
|
|
8
|
-
mode
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
filename: 'bundle.js',
|
|
13
|
-
clean: true
|
|
14
|
-
},
|
|
15
|
-
resolve: {
|
|
16
|
-
extensions: ['.js', '.vue', '.json'],
|
|
17
|
-
alias: {
|
|
18
|
-
'@': outDir,
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
externals: {
|
|
22
|
-
'vue': 'Vue',
|
|
23
|
-
'vue-router': 'VueRouter',
|
|
24
|
-
'vue-i18n': '$i18n',
|
|
25
|
-
'@/hooks': '$hooks',
|
|
26
|
-
'@/libraries': '$libraries',
|
|
27
|
-
'@/global-variables': '$globalVariables'
|
|
28
|
-
},
|
|
29
|
-
externalsType: 'window',
|
|
30
|
-
module: {
|
|
31
|
-
rules: [
|
|
32
|
-
{
|
|
33
|
-
test: /\.vue$/,
|
|
34
|
-
loader: 'vue-loader'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
test: /\.css$/,
|
|
38
|
-
use: ['style-loader', 'css-loader']
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
plugins: [
|
|
8
|
+
module.exports = (env, argv) => {
|
|
9
|
+
const isProduction = argv.mode === 'production' || process.env.NODE_ENV === 'production';
|
|
10
|
+
const outPath = path.resolve(outDir, '../dist');
|
|
11
|
+
|
|
12
|
+
const plugins = [
|
|
43
13
|
new VueLoaderPlugin(),
|
|
44
14
|
new HtmlWebpackPlugin({
|
|
45
15
|
template: path.resolve(__dirname, './index.html'),
|
|
46
16
|
inject: 'body'
|
|
47
17
|
})
|
|
48
|
-
]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// 如果是构建模式,添加 copy-webpack-plugin
|
|
21
|
+
if (isProduction) {
|
|
22
|
+
plugins.push(
|
|
23
|
+
new CopyWebpackPlugin({
|
|
24
|
+
patterns: [
|
|
25
|
+
{
|
|
26
|
+
from: path.resolve(__dirname, 'nasl.bundle.js'),
|
|
27
|
+
to: outPath,
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
);
|
|
57
32
|
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
mode: argv.mode || 'development',
|
|
36
|
+
entry: path.resolve(__dirname, './index.js'),
|
|
37
|
+
output: {
|
|
38
|
+
path: outPath,
|
|
39
|
+
filename: 'bundle.js',
|
|
40
|
+
publicPath: '/',
|
|
41
|
+
clean: true
|
|
42
|
+
},
|
|
43
|
+
resolve: {
|
|
44
|
+
extensions: ['.js', '.vue', '.json'],
|
|
45
|
+
alias: {
|
|
46
|
+
'@': outDir,
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
externals: {
|
|
50
|
+
'vue': 'Vue',
|
|
51
|
+
'vue-router': 'VueRouter',
|
|
52
|
+
'vue-i18n': '$i18n',
|
|
53
|
+
'@/hooks': '$hooks',
|
|
54
|
+
'@/libraries': '$libraries',
|
|
55
|
+
'@/global-variables': '$globalVariables'
|
|
56
|
+
},
|
|
57
|
+
externalsType: 'window',
|
|
58
|
+
module: {
|
|
59
|
+
rules: [
|
|
60
|
+
{
|
|
61
|
+
test: /\.vue$/,
|
|
62
|
+
loader: require.resolve('vue-loader')
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
test: /\.css$/,
|
|
66
|
+
use: [require.resolve('style-loader'), require.resolve('css-loader')]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
optimization: {
|
|
71
|
+
minimize: false
|
|
72
|
+
},
|
|
73
|
+
plugins,
|
|
74
|
+
devServer: {
|
|
75
|
+
static: {
|
|
76
|
+
directory: path.join(__dirname),
|
|
77
|
+
},
|
|
78
|
+
port: 3100,
|
|
79
|
+
hot: true,
|
|
80
|
+
open: true,
|
|
81
|
+
historyApiFallback: true,
|
|
82
|
+
client: {
|
|
83
|
+
overlay: false,
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
58
87
|
};
|
|
59
88
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAxios.d.ts","sourceRoot":"","sources":["../../src/apis/createAxios.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,iCAQ1C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createAxios = createAxios;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
function createAxios(baseURL) {
|
|
9
|
+
return axios_1.default.create({
|
|
10
|
+
baseURL,
|
|
11
|
+
headers: {
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
},
|
|
14
|
+
timeout: 120000,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=createAxios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAxios.js","sourceRoot":"","sources":["../../src/apis/createAxios.ts"],"names":[],"mappings":";;;;;AAEA,kCAQC;AAVD,kDAA0B;AAE1B,SAAgB,WAAW,CAAC,OAAe;IACvC,OAAO,eAAK,CAAC,MAAM,CAAC;QAChB,OAAO;QACP,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;SACrC;QACD,OAAO,EAAE,MAAM;KAClB,CAAC,CAAC;AACP,CAAC"}
|
package/out/apis/index.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { ServerOptions, TranspileOptions, TranspileResult, FileInfo } from
|
|
|
3
3
|
* 编译 NASL 代码
|
|
4
4
|
* TODO: 实现具体的 API 调用逻辑
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function compileApi(fullNaturalTS: string, options: ServerOptions): Promise<FileInfo[]>;
|
|
7
7
|
/**
|
|
8
8
|
* 检查 NASL 代码
|
|
9
9
|
* TODO: 实现具体的 API 调用逻辑
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function checkApi(fullNaturalTS: string, options: ServerOptions): Promise<string>;
|
|
12
12
|
/**
|
|
13
13
|
* 转换 NASL 代码为 AST JSON
|
|
14
14
|
* TODO: 实现具体的 API 调用逻辑
|
package/out/apis/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,aAAa,EAAE,gBAAgB,EAA8B,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKvI;;;GAGG;AACH,wBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,aAAa,EAAE,gBAAgB,EAA8B,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKvI;;;GAGG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAiCnG;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAW7F;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAmBtG"}
|
package/out/apis/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.compileApi = compileApi;
|
|
4
|
+
exports.checkApi = checkApi;
|
|
5
5
|
exports.transpile = transpile;
|
|
6
|
-
const createAxios_1 = require("
|
|
6
|
+
const createAxios_1 = require("./createAxios");
|
|
7
7
|
const logger_1 = require("../utils/logger");
|
|
8
8
|
const string_1 = require("../utils/string");
|
|
9
9
|
/**
|
|
10
10
|
* 编译 NASL 代码
|
|
11
11
|
* TODO: 实现具体的 API 调用逻辑
|
|
12
12
|
*/
|
|
13
|
-
async function
|
|
13
|
+
async function compileApi(fullNaturalTS, options) {
|
|
14
14
|
// 这里需要调用实际的编译服务接口
|
|
15
15
|
// 示例实现:
|
|
16
16
|
const axios = (0, createAxios_1.createAxios)(options.serverBaseURL);
|
|
@@ -46,7 +46,7 @@ window.backendApp = app;
|
|
|
46
46
|
* 检查 NASL 代码
|
|
47
47
|
* TODO: 实现具体的 API 调用逻辑
|
|
48
48
|
*/
|
|
49
|
-
async function
|
|
49
|
+
async function checkApi(fullNaturalTS, options) {
|
|
50
50
|
const axios = (0, createAxios_1.createAxios)(options.serverBaseURL);
|
|
51
51
|
const res = await axios.post(`/check/tsx?ideVersion=${options.ideVersion}`, fullNaturalTS, {
|
|
52
52
|
headers: { 'Content-Type': 'text/plain' },
|
|
@@ -55,7 +55,7 @@ async function check(fullNaturalTS, options) {
|
|
|
55
55
|
const errors = (result.errors || []);
|
|
56
56
|
console.log(`共检查到 ${errors.length} 个错误`);
|
|
57
57
|
if (errors.length > 0)
|
|
58
|
-
return (0, string_1.truncate)(result.errorStr,
|
|
58
|
+
return (0, string_1.truncate)(result.errorStr, 10000);
|
|
59
59
|
return '';
|
|
60
60
|
}
|
|
61
61
|
/**
|
package/out/apis/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;AASA,gCAiCC;AAMD,4BAWC;AAMD,8BAmBC;AAnFD,+CAA4C;AAC5C,4CAAyC;AACzC,4CAA2C;AAE3C;;;GAGG;AACI,KAAK,UAAU,UAAU,CAAC,aAAqB,EAAE,OAAsB;IAC1E,kBAAkB;IAClB,QAAQ;IACR,MAAM,KAAK,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,2BAA2B,OAAO,CAAC,UAAU,sBAAsB,EAAE,aAAa,EAAE;QAC7G,OAAO,EAAE,EAAE,cAA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AAM,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAuD,CAAC;IAC3F,OAAO,CAAC,GAAG,CAAC,QAAQ,MAAM,CAAC,MAAM,MAAM,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAA,iBAAQ,EAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/D,OAAO,EAAE,CAAC;AACd,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,SAAS,CAAC,KAAiB,EAAE,OAAyB;IACxE,kBAAkB;IAClB,QAAQ;IACR,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAEtC,WAAW;IACX,YAAY;IACZ,aAAa;IACb,oBAAoB;IAEpB,WAAW;IACX,mBAAmB;IACnB,aAAa;IACb,QAAQ;IACR,6BAA6B;IAC7B,6CAA6C;IAC7C,SAAS;IACT,OAAO;IACP,KAAK;AACT,CAAC"}
|
package/out/bin/nasl.js
CHANGED
|
@@ -24,18 +24,20 @@ program
|
|
|
24
24
|
.command('init')
|
|
25
25
|
.description('初始化 NASL 配置文件')
|
|
26
26
|
.action(() => {
|
|
27
|
-
(0, commands_1.
|
|
27
|
+
(0, commands_1.init)();
|
|
28
28
|
});
|
|
29
29
|
program
|
|
30
30
|
.command('compile [entry]')
|
|
31
31
|
.description('编译 NASL 代码为 Vue 和 JS')
|
|
32
|
-
.
|
|
32
|
+
.option('-v, --verbose', '显示详细信息,如依赖分析树')
|
|
33
|
+
.action(commands_1.tryCompile);
|
|
33
34
|
program
|
|
34
35
|
.command('check [entry]')
|
|
35
36
|
.description('检查 NASL 代码,包括代码中的语法和语义错误')
|
|
36
|
-
.
|
|
37
|
+
.option('-v, --verbose', '显示详细信息,如依赖分析树')
|
|
38
|
+
.action(async (entry, options) => {
|
|
37
39
|
try {
|
|
38
|
-
await (0, commands_1.
|
|
40
|
+
await (0, commands_1.check)(entry, options);
|
|
39
41
|
}
|
|
40
42
|
catch (error) {
|
|
41
43
|
logger_1.Logger.error(`检查过程发生错误:${error.message}`);
|
|
@@ -47,7 +49,7 @@ program
|
|
|
47
49
|
.description('从入口文件开始进行依赖分析')
|
|
48
50
|
.action(async (entry) => {
|
|
49
51
|
try {
|
|
50
|
-
await (0, dep_1.
|
|
52
|
+
await (0, dep_1.dep)(entry);
|
|
51
53
|
}
|
|
52
54
|
catch (error) {
|
|
53
55
|
logger_1.Logger.error(`查找依赖过程发生错误:${error.message}`);
|
|
@@ -57,15 +59,32 @@ program
|
|
|
57
59
|
program
|
|
58
60
|
.command('dev [entry]')
|
|
59
61
|
.description('启动开发服务')
|
|
60
|
-
.
|
|
62
|
+
.option('-p, --port <port>', '指定开发服务器端口号')
|
|
63
|
+
.option('-h, --host <host>', '指定开发服务器主机名')
|
|
64
|
+
.option('--open', '自动在浏览器中打开')
|
|
65
|
+
.option('--hot', '启用热模块替换 (HMR)')
|
|
66
|
+
.action(async (entry, options) => {
|
|
61
67
|
try {
|
|
62
|
-
await (0, commands_1.
|
|
68
|
+
await (0, commands_1.dev)(entry, options);
|
|
63
69
|
}
|
|
64
70
|
catch (error) {
|
|
65
71
|
logger_1.Logger.error(`开发过程发生错误:${error.message}`);
|
|
66
72
|
process.exit(1);
|
|
67
73
|
}
|
|
68
74
|
});
|
|
75
|
+
program
|
|
76
|
+
.command('build [entry]')
|
|
77
|
+
.description('构建项目')
|
|
78
|
+
.option('-m, --mode <mode>', '指定构建模式 (development/production)', 'production')
|
|
79
|
+
.action(async (entry, options) => {
|
|
80
|
+
try {
|
|
81
|
+
await (0, commands_1.build)(entry, options);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
logger_1.Logger.error(`构建过程发生错误:${error.message}`);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
69
88
|
program.parse(process.argv);
|
|
70
89
|
// 如果没有提供任何命令,显示帮助信息
|
|
71
90
|
if (!process.argv.slice(2).length) {
|
package/out/bin/nasl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nasl.js","sourceRoot":"","sources":["../../src/bin/nasl.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;
|
|
1
|
+
{"version":3,"file":"nasl.js","sourceRoot":"","sources":["../../src/bin/nasl.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AAEpC,0CAA2E;AAC3E,4CAAyC;AACzC,sEAAqC;AACrC,yCAAsC;AAGtC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAG9B,MAAM,gBAAgB,GAAG;;;;;yBAKA,CAAC;AAE1B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;;;0BAGP,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAChG,OAAO;KACF,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,eAAe,CAAC;KAC5B,MAAM,CAAC,GAAG,EAAE;IACT,IAAA,eAAI,GAAE,CAAC;AACX,CAAC,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,iBAAiB,CAAC;KAC1B,WAAW,CAAC,sBAAsB,CAAC;KACnC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC;KACxC,MAAM,CAAC,qBAAU,CAAC,CAAC;AAExB,OAAO;KACF,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC;KACxC,MAAM,CAAC,KAAK,EAAE,KAAc,EAAE,OAAwB,EAAE,EAAE;IACvD,IAAI,CAAC;QACD,MAAM,IAAA,gBAAK,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CA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iC,EAAE,YAAY,CAAC;KAC5E,MAAM,CAAC,KAAK,EAAE,KAAc,EAAE,OAAsB,EAAE,EAAE;IACrD,IAAI,CAAC;QACD,MAAM,IAAA,gBAAK,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CAAC,YAAa,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC,CAAC,CAAC;AAEP,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,oBAAoB;AACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,OAAO,CAAC,UAAU,EAAE,CAAC;AACzB,CAAC"}
|
package/out/bin/naslc.js
CHANGED
|
@@ -13,6 +13,6 @@ program
|
|
|
13
13
|
.description('编译 NASL 代码为 Vue 和 JS')
|
|
14
14
|
.version(package_json_1.default.version)
|
|
15
15
|
.argument('[entry]', '入口文件路径(可选,不填则编译整个 src 目录)')
|
|
16
|
-
.action(commands_1.
|
|
16
|
+
.action(commands_1.tryCompile);
|
|
17
17
|
program.parse(process.argv);
|
|
18
18
|
//# sourceMappingURL=naslc.js.map
|
package/out/bin/naslc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naslc.js","sourceRoot":"","sources":["../../src/bin/naslc.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"naslc.js","sourceRoot":"","sources":["../../src/bin/naslc.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,0CAAyC;AACzC,sEAAqC;AAErC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,sBAAsB,CAAC;KACnC,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;KAChD,MAAM,CAAC,qBAAU,CAAC,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAYjF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.build = build;
|
|
37
|
+
const exec_1 = require("../utils/exec");
|
|
38
|
+
const logger_1 = require("../utils/logger");
|
|
39
|
+
const compile_1 = require("./compile");
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
/**
|
|
42
|
+
* 构建命令 - 使用 webpack-cli 构建项目
|
|
43
|
+
*/
|
|
44
|
+
async function build(entry, options) {
|
|
45
|
+
const { outDir } = await (0, compile_1.compile)(entry);
|
|
46
|
+
logger_1.Logger.newLine();
|
|
47
|
+
logger_1.Logger.info('正在构建项目...');
|
|
48
|
+
const configRelativePath = path.relative(outDir, path.resolve(__dirname, '../../build/webpack.config.js'));
|
|
49
|
+
const mode = options?.mode || 'production';
|
|
50
|
+
// 构建 webpack-cli 参数
|
|
51
|
+
let webpackArgs = `${require.resolve('.bin/webpack-cli')} build --config ${configRelativePath} --mode ${mode}`;
|
|
52
|
+
await (0, exec_1.justExecCommandSync)(webpackArgs, outDir);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,sBAYC;AAxBD,wCAAoD;AACpD,4CAAyC;AACzC,uCAAoC;AACpC,2CAA6B;AAM7B;;GAEG;AACI,KAAK,UAAU,KAAK,CAAC,KAAc,EAAE,OAAsB;IAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAC;IACxC,eAAM,CAAC,OAAO,EAAE,CAAC;IACjB,eAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAEzB,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC,CAAC;IAC3G,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,YAAY,CAAC;IAE3C,oBAAoB;IACpB,IAAI,WAAW,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,kBAAkB,WAAW,IAAI,EAAE,CAAC;IAE/G,MAAM,IAAA,0BAAmB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
package/out/commands/check.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { CommandOptions } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* 检查命令 - 检查 NASL 代码的语法和语义
|
|
3
4
|
*/
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function check(entry?: string, options?: CommandOptions): Promise<void>;
|
|
5
6
|
//# sourceMappingURL=check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,wBAAsB,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCnF"}
|
package/out/commands/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.check = check;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const apis_1 = require("../apis");
|
|
6
6
|
const compose_1 = require("../services/compose");
|
|
@@ -8,25 +8,33 @@ const resolve_1 = require("../services/resolve");
|
|
|
8
8
|
/**
|
|
9
9
|
* 检查命令 - 检查 NASL 代码的语法和语义
|
|
10
10
|
*/
|
|
11
|
-
async function
|
|
11
|
+
async function check(entry, options) {
|
|
12
12
|
utils_1.Logger.info('开始检查 NASL 代码...');
|
|
13
13
|
// 收集需要检查的文件
|
|
14
|
-
const {
|
|
14
|
+
const { collectedFiles, config } = await (0, resolve_1.resolveNASLFiles)(entry, false, options?.verbose);
|
|
15
15
|
// 调用检查 API
|
|
16
16
|
utils_1.Logger.newLine();
|
|
17
17
|
utils_1.Logger.info('正在调用检查服务,对语法和语义进行检查...');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
let fullNaturalTS = '';
|
|
19
|
+
let result = '';
|
|
20
|
+
try {
|
|
21
|
+
fullNaturalTS = (0, compose_1.composeToString)(collectedFiles);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
result = error.message.trim();
|
|
25
|
+
}
|
|
26
|
+
if (!result && fullNaturalTS) {
|
|
27
|
+
result = (await (0, apis_1.checkApi)(fullNaturalTS, {
|
|
28
|
+
serverBaseURL: config.serverBaseURL,
|
|
29
|
+
ideVersion: config.ideVersion,
|
|
30
|
+
})).trim();
|
|
31
|
+
}
|
|
32
|
+
if (result || process.env.DEBUG_TO_FILE_WHEN_SUCCESS) {
|
|
33
|
+
utils_1.Logger.debugToFile('check', result + '\n============\n' + fullNaturalTS);
|
|
34
|
+
}
|
|
24
35
|
if (result) {
|
|
25
36
|
utils_1.Logger.error('\n' + result);
|
|
26
37
|
process.exit(1);
|
|
27
38
|
}
|
|
28
|
-
else {
|
|
29
|
-
// Logger.debug('检查通过!');
|
|
30
|
-
}
|
|
31
39
|
}
|
|
32
40
|
//# sourceMappingURL=check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":";;AASA,sBAiCC;AA1CD,oCAAkC;AAClC,kCAAmC;AACnC,iDAAsD;AACtD,iDAAuD;AAGvD;;GAEG;AACI,KAAK,UAAU,KAAK,CAAC,KAAc,EAAE,OAAwB;IAChE,cAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAE/B,YAAY;IACZ,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,0BAAgB,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE1F,WAAW;IACX,cAAM,CAAC,OAAO,EAAE,CAAC;IACjB,cAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAEtC,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC;QACD,aAAa,GAAG,IAAA,yBAAe,EAAC,cAAc,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,GAAI,KAAe,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,aAAa,EAAE,CAAC;QAC3B,MAAM,GAAG,CAAC,MAAM,IAAA,eAAQ,EAAC,aAAa,EAAE;YACpC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,MAAM,CAAC,UAAU;SAChC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAED,IAAI,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC;QACnD,cAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,GAAG,aAAa,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACT,cAAM,CAAC,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { CommandOptions } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* 编译命令 - 将 NASL 编译为 Vue 和 JS
|
|
3
4
|
*/
|
|
4
|
-
export declare function
|
|
5
|
-
config: import("
|
|
5
|
+
export declare function compile(entry?: string, options?: CommandOptions): Promise<{
|
|
6
|
+
config: import("../types").NASLConfig;
|
|
6
7
|
outDir: string;
|
|
7
8
|
}>;
|
|
8
|
-
export declare function
|
|
9
|
+
export declare function tryCompile(entry?: string, options?: CommandOptions): Promise<void>;
|
|
9
10
|
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,wBAAsB,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc;;;GAkCrE;AAED,wBAAsB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,iBAOxE"}
|
package/out/commands/compile.js
CHANGED
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
36
|
+
exports.compile = compile;
|
|
37
|
+
exports.tryCompile = tryCompile;
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const utils_1 = require("../utils");
|
|
40
40
|
const apis_1 = require("../apis");
|
|
@@ -43,19 +43,18 @@ const resolve_1 = require("../services/resolve");
|
|
|
43
43
|
/**
|
|
44
44
|
* 编译命令 - 将 NASL 编译为 Vue 和 JS
|
|
45
45
|
*/
|
|
46
|
-
async function
|
|
46
|
+
async function compile(entry, options) {
|
|
47
47
|
utils_1.Logger.info('开始编译 NASL 代码...');
|
|
48
48
|
// 收集需要编译的文件
|
|
49
|
-
const {
|
|
49
|
+
const { collectedFiles, config, projectRoot } = await (0, resolve_1.resolveNASLFiles)(entry, false, options?.verbose);
|
|
50
50
|
utils_1.Logger.info(`输出目录: ${config.outDir}`);
|
|
51
51
|
const outDir = path.join(projectRoot, config.outDir);
|
|
52
52
|
// 调用编译 API
|
|
53
53
|
utils_1.Logger.newLine();
|
|
54
54
|
utils_1.Logger.info('正在调用编译服务...');
|
|
55
55
|
try {
|
|
56
|
-
const fullNaturalTS = (0, compose_1.composeToString)(
|
|
57
|
-
|
|
58
|
-
const outputFiles = await (0, apis_1.compile)(fullNaturalTS, {
|
|
56
|
+
const fullNaturalTS = (0, compose_1.composeToString)(collectedFiles);
|
|
57
|
+
const outputFiles = await (0, apis_1.compileApi)(fullNaturalTS, {
|
|
59
58
|
serverBaseURL: config.serverBaseURL,
|
|
60
59
|
ideVersion: config.ideVersion,
|
|
61
60
|
});
|
|
@@ -64,7 +63,6 @@ async function compileCommand(entry) {
|
|
|
64
63
|
for (const file of outputFiles) {
|
|
65
64
|
const outputPath = path.join(outDir, file.path);
|
|
66
65
|
(0, utils_1.writeFileWithLog)(outputPath, file.content);
|
|
67
|
-
utils_1.Logger.debug(`写入文件: ${outputPath}`);
|
|
68
66
|
}
|
|
69
67
|
utils_1.Logger.info(`输出 ${outputFiles.length} 个文件`);
|
|
70
68
|
utils_1.Logger.success(`所有文件已输出到: ${outDir}`);
|
|
@@ -75,9 +73,9 @@ async function compileCommand(entry) {
|
|
|
75
73
|
}
|
|
76
74
|
return { config, outDir };
|
|
77
75
|
}
|
|
78
|
-
async function
|
|
76
|
+
async function tryCompile(entry, options) {
|
|
79
77
|
try {
|
|
80
|
-
await
|
|
78
|
+
await compile(entry, options);
|
|
81
79
|
}
|
|
82
80
|
catch (error) {
|
|
83
81
|
utils_1.Logger.error(`编译过程发生错误:${error.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,0BAkCC;AAED,gCAOC;AArDD,2CAA6B;AAC7B,oCAAoD;AACpD,kCAAqC;AACrC,iDAAsD;AACtD,iDAAuD;AAGvD;;GAEG;AACI,KAAK,UAAU,OAAO,CAAC,KAAc,EAAE,OAAwB;IAClE,cAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAE/B,YAAY;IACZ,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,0BAAgB,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAEvG,cAAM,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI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AAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC"}
|
package/out/commands/dep.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dep.d.ts","sourceRoot":"","sources":["../../src/commands/dep.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,
|
|
1
|
+
{"version":3,"file":"dep.d.ts","sourceRoot":"","sources":["../../src/commands/dep.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,6DAIvC"}
|
package/out/commands/dep.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.dep = dep;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const resolve_1 = require("../services/resolve");
|
|
6
6
|
/**
|
|
7
7
|
* 检查命令 - 检查 NASL 代码的语法和语义
|
|
8
8
|
*/
|
|
9
|
-
async function
|
|
9
|
+
async function dep(entry) {
|
|
10
10
|
utils_1.Logger.info('开始进行依赖分析...');
|
|
11
|
-
|
|
11
|
+
return (0, resolve_1.resolveNASLFiles)(entry, true, true);
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=dep.js.map
|
package/out/commands/dep.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dep.js","sourceRoot":"","sources":["../../src/commands/dep.ts"],"names":[],"mappings":";;AAMA,
|
|
1
|
+
{"version":3,"file":"dep.js","sourceRoot":"","sources":["../../src/commands/dep.ts"],"names":[],"mappings":";;AAMA,kBAIC;AAVD,oCAAkC;AAClC,iDAAuD;AAEvD;;GAEG;AACI,KAAK,UAAU,GAAG,CAAC,KAAc;IACpC,cAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE3B,OAAO,IAAA,0BAAgB,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC"}
|
package/out/commands/dev.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
export interface DevOptions {
|
|
2
|
+
port?: string;
|
|
3
|
+
host?: string;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
hot?: boolean;
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* 编译命令 - 将 NASL 编译为 Vue 和 JS
|
|
3
9
|
*/
|
|
4
|
-
export declare function
|
|
10
|
+
export declare function dev(entry?: string, options?: DevOptions): Promise<void>;
|
|
5
11
|
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB7E"}
|