@aiot-toolkit/generator 2.0.1-alpha.9 → 2.0.2-dev.1
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/lib/index.js
CHANGED
|
@@ -6,5 +6,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TypescriptGenerator = void 0;
|
|
7
7
|
const TypescriptGenerator_1 = __importDefault(require("./typescript/TypescriptGenerator"));
|
|
8
8
|
exports.TypescriptGenerator = TypescriptGenerator_1.default;
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/generator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-dev.1",
|
|
4
4
|
"description": "Generate source code and sourcemap from the AST ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "node ./__tests__/generator.test.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aiot-toolkit/shared-utils": "2.0.
|
|
28
|
+
"@aiot-toolkit/shared-utils": "2.0.2-dev.1"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "0beecc786c41b73ab2dabeaad06fb4ad19115f4b"
|
|
31
31
|
}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,2FAAkE;AAEzD,8BAFF,6BAAmB,CAEE","file":"index.js","sourcesContent":["import TypescriptGenerator from './typescript/TypescriptGenerator'\n\nexport { TypescriptGenerator }\n"],"sourceRoot":"../src"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["typescript/TypescriptGenerator.ts"],"names":[],"mappings":";;AACA,2CAA+C;AAG/C,MAAM,mBAAmB;IACvB,QAAQ,CAAC,MAKR;QACC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;QAC/D,SAAS;QACT,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;QAC9B,8BAA8B;QAC9B,MAAM,SAAS,GAAG,IAAI,+BAAkB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAA;QAElE,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,SAAS,CAAC,UAAU,CAAC;gBACnB,MAAM,EAAE,cAAc;gBACtB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE;oBACR,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;oBAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;iBAChC;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;oBAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;iBAChC;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAA;QACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;IAC5B,CAAC;CACF;AAED,kBAAe,mBAAmB,CAAA","file":"TypescriptGenerator.js","sourcesContent":["import { MapData } from '@aiot-toolkit/shared-utils'\nimport { SourceMapGenerator } from 'source-map'\nimport { SourceFile } from 'ts-morph'\n\nclass TypescriptGenerator {\n generate(params: {\n sourceFilePath: string\n targetFilePath: string\n ast: SourceFile\n mapList: MapData[]\n }): { code: string; sourcemap: string } {\n const { sourceFilePath, ast, targetFilePath, mapList } = params\n // 生成写入源码\n const code = ast.getFullText()\n // 构建 sourcemap 数据生成 sourcemap\n const generator = new SourceMapGenerator({ file: targetFilePath })\n\n mapList.forEach((item) => {\n generator.addMapping({\n source: sourceFilePath,\n name: item.name,\n original: {\n line: item.source.startLine,\n column: item.source.startColumn\n },\n generated: {\n line: item.target.startLine,\n column: item.target.startColumn\n }\n })\n })\n\n const sourcemap = generator.toString()\n return { code, sourcemap }\n }\n}\n\nexport default TypescriptGenerator\n"],"sourceRoot":"../../src"}
|