@nasl/cli 0.3.0 → 0.3.2
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 +14 -0
- package/dist/bin/nasl.mjs +201 -10
- package/dist/bin/nasl.mjs.map +1 -1
- package/dist/bin/naslc.mjs +7 -7
- package/dist/bin/naslc.mjs.map +1 -1
- package/dist/index.mjs +243 -8
- package/dist/index.mjs.map +1 -1
- package/out/apis/compileApi.d.ts +4 -0
- package/out/apis/compileApi.d.ts.map +1 -1
- package/out/apis/compileApi.js +27 -0
- package/out/apis/compileApi.js.map +1 -1
- package/out/bin/nasl-doc.d.ts +3 -0
- package/out/bin/nasl-doc.d.ts.map +1 -0
- package/out/bin/nasl-doc.js +36 -0
- package/out/bin/nasl-doc.js.map +1 -0
- package/out/bin/nasl.js +2 -2
- package/out/bin/nasl.js.map +1 -1
- package/out/commands/docCheck.d.ts +18 -0
- package/out/commands/docCheck.d.ts.map +1 -0
- package/out/commands/docCheck.js +172 -0
- package/out/commands/docCheck.js.map +1 -0
- package/out/commands/index.d.ts +1 -0
- package/out/commands/index.d.ts.map +1 -1
- package/out/commands/index.js +1 -0
- package/out/commands/index.js.map +1 -1
- package/out/commands/transform.d.ts +1 -1
- package/out/commands/transform.d.ts.map +1 -1
- package/out/commands/transform.js +28 -0
- package/out/commands/transform.js.map +1 -1
- package/out/services/compose.d.ts +4 -1
- package/out/services/compose.d.ts.map +1 -1
- package/out/services/compose.js +5 -5
- package/out/services/compose.js.map +1 -1
- package/package.json +6 -4
package/dist/bin/naslc.mjs
CHANGED
|
@@ -26454,7 +26454,7 @@ function setProxy(options, configProxy, location) {
|
|
|
26454
26454
|
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
26455
26455
|
}
|
|
26456
26456
|
|
|
26457
|
-
options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
|
|
26457
|
+
options.headers.host = options.hostname + (options.port ? ':' + options.port : options.protocol === 'https:' ? ':443' : '');
|
|
26458
26458
|
const proxyHost = proxy.hostname || proxy.host;
|
|
26459
26459
|
options.hostname = proxyHost;
|
|
26460
26460
|
// Replace 'host' since options is not a URL object
|
|
@@ -26871,7 +26871,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
26871
26871
|
} else {
|
|
26872
26872
|
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
26873
26873
|
options.port = parsed.port;
|
|
26874
|
-
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port :
|
|
26874
|
+
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|
26875
26875
|
}
|
|
26876
26876
|
|
|
26877
26877
|
let transport;
|
|
@@ -29191,7 +29191,7 @@ function validateExtensionsFile(file, errors) {
|
|
|
29191
29191
|
/**
|
|
29192
29192
|
* 验证普通文件(枚举、实体、数据结构、逻辑、页面)
|
|
29193
29193
|
*/
|
|
29194
|
-
function validateNormalFile(file, nameFromPath, namespace, errors) {
|
|
29194
|
+
function validateNormalFile(file, nameFromPath, namespace, errors, options) {
|
|
29195
29195
|
const matchArr = Array.from(file.content.matchAll(/^(export\s+)?(declare\s+)?(function|class|interface)\s+(\w+)/gm));
|
|
29196
29196
|
if (matchArr.length === 0)
|
|
29197
29197
|
errors.push(`${file.path} 必须有一个函数或类,错误代码:${file.content}`);
|
|
@@ -29203,14 +29203,14 @@ function validateNormalFile(file, nameFromPath, namespace, errors) {
|
|
|
29203
29203
|
if (!isExport)
|
|
29204
29204
|
errors.push(`${file.path} 必须使用 export,错误代码:${match[0]}`);
|
|
29205
29205
|
if (name !== nameFromPath)
|
|
29206
|
-
errors.push(`${file.path}
|
|
29206
|
+
errors.push(`${file.path} 的函数或类名必须与${'文件名'}一致,错误代码:${match[0]}`);
|
|
29207
29207
|
if (/\.(entities|enums|structures)/.test(namespace) && type !== 'class')
|
|
29208
29208
|
errors.push(`${file.path} 实体、数据结构和枚举只能使用 class 定义,错误代码:${match[0]}`);
|
|
29209
29209
|
if (/\.(logics|views)/.test(namespace) && type !== 'function')
|
|
29210
29210
|
errors.push(`${file.path} 逻辑和页面只能使用 function 定义,错误代码:${match[0]}`);
|
|
29211
29211
|
}
|
|
29212
29212
|
}
|
|
29213
|
-
function composeToString(files) {
|
|
29213
|
+
function composeToString(files, options) {
|
|
29214
29214
|
files.sort((a, b) => sorter(a.path, b.path));
|
|
29215
29215
|
const errors = [];
|
|
29216
29216
|
let currentLine = 1;
|
|
@@ -29225,7 +29225,7 @@ function composeToString(files) {
|
|
|
29225
29225
|
const isExtensionsFile = arr[0] === 'extensions';
|
|
29226
29226
|
const isThemeCss = ext === 'css' && nameFromPath === 'theme';
|
|
29227
29227
|
const isSpecialFile = isVariablesFile || isExtensionsFile || isThemeCss;
|
|
29228
|
-
// 特殊文件的 namespace 包含文件名,普通文件不包含
|
|
29228
|
+
// 特殊文件的 namespace ${包含文件名,普通文件不包含
|
|
29229
29229
|
const namespace = isSpecialFile ? [...arr, nameFromPath].join('.') : arr.join('.');
|
|
29230
29230
|
let content = file.content;
|
|
29231
29231
|
if (['ts', 'tsx'].includes(ext)) {
|
|
@@ -38445,7 +38445,7 @@ async function tryCompile(entry, options) {
|
|
|
38445
38445
|
}
|
|
38446
38446
|
}
|
|
38447
38447
|
|
|
38448
|
-
var version = "0.3.
|
|
38448
|
+
var version = "0.3.2";
|
|
38449
38449
|
var pkg = {
|
|
38450
38450
|
version: version};
|
|
38451
38451
|
|