@powerlines/plugin-tsc 0.2.468 → 0.2.471
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 +6 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_helpers_type_check = require('./helpers/type-check.cjs');
|
|
4
4
|
require('./helpers/index.cjs');
|
|
5
|
-
let defu = require("defu");
|
|
6
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
7
|
-
let powerlines_constants = require("powerlines/constants");
|
|
8
5
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
9
6
|
let typescript = require("typescript");
|
|
10
7
|
typescript = require_runtime.__toESM(typescript, 1);
|
|
@@ -21,13 +18,14 @@ const plugin = (options = {}) => {
|
|
|
21
18
|
name: "tsc",
|
|
22
19
|
config() {
|
|
23
20
|
this.trace("Merging TypeScript Compiler plugin configuration");
|
|
24
|
-
return { tsc:
|
|
21
|
+
return { tsc: {
|
|
25
22
|
typeCheck: false,
|
|
26
23
|
filter: { id: {
|
|
27
24
|
include: /\.(?:[cm]?ts|tsx)(?=\s*$)/i,
|
|
28
25
|
exclude: /\.(?:d|spec|test)\.(?:[cm]?ts|tsx)(?=\s*$)/i
|
|
29
|
-
} }
|
|
30
|
-
|
|
26
|
+
} },
|
|
27
|
+
...options
|
|
28
|
+
} };
|
|
31
29
|
},
|
|
32
30
|
async lint() {
|
|
33
31
|
if (this.config.tsc.typeCheck) await require_helpers_type_check.typeCheck(this);
|
|
@@ -35,7 +33,7 @@ const plugin = (options = {}) => {
|
|
|
35
33
|
transform: {
|
|
36
34
|
filter: { id: { exclude: /\.(?:[cm]?js|jsx)(?=\s*$)/i } },
|
|
37
35
|
async handler(code, id) {
|
|
38
|
-
if (!(0, powerlines_plugin_utils.createFilterForTransform)(this.config.tsc.filter
|
|
36
|
+
if (this.config.tsc.filter && !(0, powerlines_plugin_utils.createFilterForTransform)(this.config.tsc.filter.id, this.config.tsc.filter.code)?.(id, code)) return {
|
|
39
37
|
code,
|
|
40
38
|
id
|
|
41
39
|
};
|
|
@@ -45,7 +43,7 @@ const plugin = (options = {}) => {
|
|
|
45
43
|
...this.tsconfig.options,
|
|
46
44
|
...this.config.tsc.compilerOptions
|
|
47
45
|
},
|
|
48
|
-
fileName:
|
|
46
|
+
fileName: (0, powerlines_plugin_utils.removeVirtualPrefix)(id)
|
|
49
47
|
});
|
|
50
48
|
if (result.diagnostics && result.diagnostics.length > 0 && result.diagnostics?.some((diagnostic) => diagnostic.category === typescript.default.DiagnosticCategory.Error)) throw new Error(`TypeScript Compiler - TypeScript transpilation errors in file: ${id}\n${typescript.default.formatDiagnostics(result.diagnostics, {
|
|
51
49
|
getCanonicalFileName: (fileName) => typescript.default.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAkCY,MAAA;IACR,GAAA,GAAM,+BAAA;EAAA;AAAA;;;;;;;cAUG,MAAA,oBACM,+BAAA,GACf,+BAAA,EAEF,OAAA,GAAS,+BAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAkCY,MAAA;IACR,GAAA,GAAM,+BAAA;EAAA;AAAA;;;;;;;cAUG,MAAA,oBACM,+BAAA,GACf,+BAAA,EAEF,OAAA,GAAS,+BAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { typeCheck } from "./helpers/type-check.mjs";
|
|
2
2
|
import "./helpers/index.mjs";
|
|
3
|
-
import
|
|
4
|
-
import { VIRTUAL_MODULE_PREFIX_REGEX } from "powerlines/constants";
|
|
5
|
-
import { createFilterForTransform } from "powerlines/plugin-utils";
|
|
3
|
+
import { createFilterForTransform, removeVirtualPrefix } from "powerlines/plugin-utils";
|
|
6
4
|
import ts from "typescript";
|
|
7
5
|
|
|
8
6
|
//#region src/index.ts
|
|
@@ -17,13 +15,14 @@ const plugin = (options = {}) => {
|
|
|
17
15
|
name: "tsc",
|
|
18
16
|
config() {
|
|
19
17
|
this.trace("Merging TypeScript Compiler plugin configuration");
|
|
20
|
-
return { tsc:
|
|
18
|
+
return { tsc: {
|
|
21
19
|
typeCheck: false,
|
|
22
20
|
filter: { id: {
|
|
23
21
|
include: /\.(?:[cm]?ts|tsx)(?=\s*$)/i,
|
|
24
22
|
exclude: /\.(?:d|spec|test)\.(?:[cm]?ts|tsx)(?=\s*$)/i
|
|
25
|
-
} }
|
|
26
|
-
|
|
23
|
+
} },
|
|
24
|
+
...options
|
|
25
|
+
} };
|
|
27
26
|
},
|
|
28
27
|
async lint() {
|
|
29
28
|
if (this.config.tsc.typeCheck) await typeCheck(this);
|
|
@@ -31,7 +30,7 @@ const plugin = (options = {}) => {
|
|
|
31
30
|
transform: {
|
|
32
31
|
filter: { id: { exclude: /\.(?:[cm]?js|jsx)(?=\s*$)/i } },
|
|
33
32
|
async handler(code, id) {
|
|
34
|
-
if (!createFilterForTransform(this.config.tsc.filter
|
|
33
|
+
if (this.config.tsc.filter && !createFilterForTransform(this.config.tsc.filter.id, this.config.tsc.filter.code)?.(id, code)) return {
|
|
35
34
|
code,
|
|
36
35
|
id
|
|
37
36
|
};
|
|
@@ -41,7 +40,7 @@ const plugin = (options = {}) => {
|
|
|
41
40
|
...this.tsconfig.options,
|
|
42
41
|
...this.config.tsc.compilerOptions
|
|
43
42
|
},
|
|
44
|
-
fileName: id
|
|
43
|
+
fileName: removeVirtualPrefix(id)
|
|
45
44
|
});
|
|
46
45
|
if (result.diagnostics && result.diagnostics.length > 0 && result.diagnostics?.some((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error)) throw new Error(`TypeScript Compiler - TypeScript transpilation errors in file: ${id}\n${ts.formatDiagnostics(result.diagnostics, {
|
|
47
46
|
getCanonicalFileName: (fileName) => ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"powerlines\";\nimport {\n createFilterForTransform,\n removeVirtualPrefix\n} from \"powerlines/plugin-utils\";\nimport ts from \"typescript\";\nimport { typeCheck } from \"./helpers/type-check\";\nimport type {\n TypeScriptCompilerPluginContext,\n TypeScriptCompilerPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n tsc?: TypeScriptCompilerPluginOptions;\n }\n}\n\n/**\n * TypeScript Compiler plugin for Powerlines.\n *\n * @param options - The TypeScript Compiler plugin user configuration options.\n * @returns A Powerlines plugin that integrates TypeScript Compiler transformations.\n */\nexport const plugin = <\n TContext extends TypeScriptCompilerPluginContext =\n TypeScriptCompilerPluginContext\n>(\n options: TypeScriptCompilerPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsc\",\n config() {\n this.trace(\"Merging TypeScript Compiler plugin configuration\");\n\n return {\n tsc: {\n typeCheck: false,\n filter: {\n id: {\n include: /\\.(?:[cm]?ts|tsx)(?=\\s*$)/i,\n exclude: /\\.(?:d|spec|test)\\.(?:[cm]?ts|tsx)(?=\\s*$)/i\n }\n },\n ...options\n }\n };\n },\n async lint() {\n if (this.config.tsc.typeCheck) {\n await typeCheck(this);\n }\n },\n transform: {\n filter: {\n id: { exclude: /\\.(?:[cm]?js|jsx)(?=\\s*$)/i }\n },\n async handler(code: string, id: string) {\n if (\n this.config.tsc.filter &&\n !createFilterForTransform(\n this.config.tsc.filter.id,\n this.config.tsc.filter.code\n )?.(id, code)\n ) {\n return { code, id };\n }\n\n const result = ts.transpileModule(code, {\n ...this.config.tsc,\n compilerOptions: {\n ...this.tsconfig.options,\n ...this.config.tsc.compilerOptions\n },\n fileName: removeVirtualPrefix(id)\n });\n if (\n result.diagnostics &&\n result.diagnostics.length > 0 &&\n result.diagnostics?.some(\n diagnostic => diagnostic.category === ts.DiagnosticCategory.Error\n )\n ) {\n throw new Error(\n `TypeScript Compiler - TypeScript transpilation errors in file: ${id}\\n${ts.formatDiagnostics(\n result.diagnostics,\n {\n getCanonicalFileName: fileName =>\n ts.sys.useCaseSensitiveFileNames\n ? fileName\n : fileName.toLowerCase(),\n getCurrentDirectory: () => ts.sys.getCurrentDirectory(),\n getNewLine: () => ts.sys.newLine\n }\n )}`\n );\n }\n\n if (!result.outputText) {\n throw new Error(\n `TypeScript Compiler - No output generated for file during TypeScript transpilation: ${id}`\n );\n }\n\n return { code: result.outputText, id };\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AA6CA,MAAa,UAIX,UAA2C,EAAE,KACxB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,QAAK,MAAM,mDAAmD;AAE9D,UAAO,EACL,KAAK;IACH,WAAW;IACX,QAAQ,EACN,IAAI;KACF,SAAS;KACT,SAAS;KACV,EACF;IACD,GAAG;IACJ,EACF;;EAEH,MAAM,OAAO;AACX,OAAI,KAAK,OAAO,IAAI,UAClB,OAAM,UAAU,KAAK;;EAGzB,WAAW;GACT,QAAQ,EACN,IAAI,EAAE,SAAS,8BAA8B,EAC9C;GACD,MAAM,QAAQ,MAAc,IAAY;AACtC,QACE,KAAK,OAAO,IAAI,UAChB,CAAC,yBACC,KAAK,OAAO,IAAI,OAAO,IACvB,KAAK,OAAO,IAAI,OAAO,KACxB,GAAG,IAAI,KAAK,CAEb,QAAO;KAAE;KAAM;KAAI;IAGrB,MAAM,SAAS,GAAG,gBAAgB,MAAM;KACtC,GAAG,KAAK,OAAO;KACf,iBAAiB;MACf,GAAG,KAAK,SAAS;MACjB,GAAG,KAAK,OAAO,IAAI;MACpB;KACD,UAAU,oBAAoB,GAAG;KAClC,CAAC;AACF,QACE,OAAO,eACP,OAAO,YAAY,SAAS,KAC5B,OAAO,aAAa,MAClB,eAAc,WAAW,aAAa,GAAG,mBAAmB,MAC7D,CAED,OAAM,IAAI,MACR,kEAAkE,GAAG,IAAI,GAAG,kBAC1E,OAAO,aACP;KACE,uBAAsB,aACpB,GAAG,IAAI,4BACH,WACA,SAAS,aAAa;KAC5B,2BAA2B,GAAG,IAAI,qBAAqB;KACvD,kBAAkB,GAAG,IAAI;KAC1B,CACF,GACF;AAGH,QAAI,CAAC,OAAO,WACV,OAAM,IAAI,MACR,uFAAuF,KACxF;AAGH,WAAO;KAAE,MAAM,OAAO;KAAY;KAAI;;GAEzC;EACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-tsc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.471",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing the TypeScript compiler plugin for Powerlines.",
|
|
6
6
|
"repository": {
|
|
@@ -120,14 +120,14 @@
|
|
|
120
120
|
"dependencies": {
|
|
121
121
|
"@stryke/path": "^0.28.2",
|
|
122
122
|
"defu": "^6.1.7",
|
|
123
|
-
"powerlines": "^0.
|
|
123
|
+
"powerlines": "^0.47.1",
|
|
124
124
|
"unplugin": "^3.0.0",
|
|
125
125
|
"typescript": "^6.0.3"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
128
|
+
"@powerlines/plugin-plugin": "^0.12.413",
|
|
129
129
|
"@types/node": "^25.6.0"
|
|
130
130
|
},
|
|
131
131
|
"publishConfig": { "access": "public" },
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "3d2c2a8ebb3941045a9aaeb5218c96368847c371"
|
|
133
133
|
}
|