@powerlines/plugin-deepkit 0.10.130 → 0.10.132
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/_virtual/rolldown_runtime.cjs +37 -1
- package/dist/_virtual/rolldown_runtime.mjs +29 -1
- package/dist/deepkit/src/transformer.cjs +52 -1
- package/dist/deepkit/src/transformer.mjs +49 -1
- package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
- package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
- package/dist/index.cjs +64 -1
- package/dist/index.mjs +61 -1
- package/dist/plugin-tsc/src/helpers/index.cjs +1 -1
- package/dist/plugin-tsc/src/helpers/index.mjs +3 -1
- package/dist/plugin-tsc/src/helpers/type-check.cjs +22 -4
- package/dist/plugin-tsc/src/helpers/type-check.mjs +21 -4
- package/dist/plugin-tsc/src/index.cjs +50 -1
- package/dist/plugin-tsc/src/index.mjs +47 -1
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +7 -7
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
23
|
+
if (symbols) {
|
|
24
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
26
|
+
}
|
|
27
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
|
|
36
|
+
exports.__reExport = __reExport;
|
|
37
|
+
exports.__toESM = __toESM;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
9
|
+
key = keys[i];
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
11
|
+
__defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
21
|
+
if (symbols) {
|
|
22
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
24
|
+
}
|
|
25
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { __reExport };
|
|
@@ -1 +1,52 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('./vendor/type-compiler/index.cjs');
|
|
3
|
+
let defu = require("defu");
|
|
4
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
5
|
+
|
|
6
|
+
//#region ../deepkit/src/transformer.ts
|
|
7
|
+
let loaded = false;
|
|
8
|
+
const cache = new require_index.type_compiler_exports.Cache();
|
|
9
|
+
/**
|
|
10
|
+
* Creates a Deepkit TypeScript transformer.
|
|
11
|
+
*
|
|
12
|
+
* @param context - The Powerlines plugin context.
|
|
13
|
+
* @param options - The transformation options.
|
|
14
|
+
* @returns A Deepkit TypeScript custom transformer factory.
|
|
15
|
+
*/
|
|
16
|
+
function createTransformer(context, options = {}) {
|
|
17
|
+
return function transformer(ctx) {
|
|
18
|
+
if (!loaded) loaded = true;
|
|
19
|
+
cache.tick();
|
|
20
|
+
return new require_index.type_compiler_exports.ReflectionTransformer(ctx, cache).withReflection((0, defu.default)(options, {
|
|
21
|
+
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
22
|
+
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
23
|
+
}, {
|
|
24
|
+
exclude: [],
|
|
25
|
+
reflection: "default",
|
|
26
|
+
reflectionLevel: "minimal"
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a Deepkit TypeScript declaration transformer.
|
|
32
|
+
*
|
|
33
|
+
* @param context - The Powerlines plugin context.
|
|
34
|
+
* @param options - The transformation options.
|
|
35
|
+
* @returns A Deepkit TypeScript custom declaration transformer factory.
|
|
36
|
+
*/
|
|
37
|
+
function createDeclarationTransformer(context, options = {}) {
|
|
38
|
+
return function declarationTransformer(ctx) {
|
|
39
|
+
return new require_index.type_compiler_exports.DeclarationTransformer(ctx, cache).withReflection((0, defu.default)(options, {
|
|
40
|
+
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
41
|
+
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
42
|
+
}, {
|
|
43
|
+
exclude: [],
|
|
44
|
+
reflection: "default",
|
|
45
|
+
reflectionLevel: "minimal"
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.createDeclarationTransformer = createDeclarationTransformer;
|
|
52
|
+
exports.createTransformer = createTransformer;
|
|
@@ -1 +1,49 @@
|
|
|
1
|
-
import{type_compiler_exports
|
|
1
|
+
import { type_compiler_exports } from "./vendor/type-compiler/index.mjs";
|
|
2
|
+
import defu from "defu";
|
|
3
|
+
|
|
4
|
+
//#region ../deepkit/src/transformer.ts
|
|
5
|
+
let loaded = false;
|
|
6
|
+
const cache = new type_compiler_exports.Cache();
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Deepkit TypeScript transformer.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The Powerlines plugin context.
|
|
11
|
+
* @param options - The transformation options.
|
|
12
|
+
* @returns A Deepkit TypeScript custom transformer factory.
|
|
13
|
+
*/
|
|
14
|
+
function createTransformer(context, options = {}) {
|
|
15
|
+
return function transformer(ctx) {
|
|
16
|
+
if (!loaded) loaded = true;
|
|
17
|
+
cache.tick();
|
|
18
|
+
return new type_compiler_exports.ReflectionTransformer(ctx, cache).withReflection(defu(options, {
|
|
19
|
+
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
20
|
+
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
21
|
+
}, {
|
|
22
|
+
exclude: [],
|
|
23
|
+
reflection: "default",
|
|
24
|
+
reflectionLevel: "minimal"
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a Deepkit TypeScript declaration transformer.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The Powerlines plugin context.
|
|
32
|
+
* @param options - The transformation options.
|
|
33
|
+
* @returns A Deepkit TypeScript custom declaration transformer factory.
|
|
34
|
+
*/
|
|
35
|
+
function createDeclarationTransformer(context, options = {}) {
|
|
36
|
+
return function declarationTransformer(ctx) {
|
|
37
|
+
return new type_compiler_exports.DeclarationTransformer(ctx, cache).withReflection(defu(options, {
|
|
38
|
+
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
39
|
+
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
40
|
+
}, {
|
|
41
|
+
exclude: [],
|
|
42
|
+
reflection: "default",
|
|
43
|
+
reflectionLevel: "minimal"
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { createDeclarationTransformer, createTransformer };
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../deepkit/src/vendor/type-compiler/index.ts
|
|
4
|
+
var type_compiler_exports = {};
|
|
5
|
+
require_rolldown_runtime.__reExport(type_compiler_exports, require("@deepkit/type-compiler"));
|
|
6
|
+
require_rolldown_runtime.__reExport(type_compiler_exports, require("@deepkit/type-compiler/compiler"));
|
|
7
|
+
require_rolldown_runtime.__reExport(type_compiler_exports, require("@deepkit/type-compiler/config"));
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
Object.defineProperty(exports, 'type_compiler_exports', {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return type_compiler_exports;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
var __deepkit_type_compiler = require("@deepkit/type-compiler");
|
|
17
|
+
Object.keys(__deepkit_type_compiler).forEach(function (k) {
|
|
18
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return __deepkit_type_compiler[k]; }
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
var __deepkit_type_compiler_compiler = require("@deepkit/type-compiler/compiler");
|
|
25
|
+
Object.keys(__deepkit_type_compiler_compiler).forEach(function (k) {
|
|
26
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return __deepkit_type_compiler_compiler[k]; }
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var __deepkit_type_compiler_config = require("@deepkit/type-compiler/config");
|
|
33
|
+
Object.keys(__deepkit_type_compiler_config).forEach(function (k) {
|
|
34
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return __deepkit_type_compiler_config[k]; }
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import{__reExport
|
|
1
|
+
import { __reExport } from "../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
export * from "@deepkit/type-compiler"
|
|
4
|
+
|
|
5
|
+
export * from "@deepkit/type-compiler/compiler"
|
|
6
|
+
|
|
7
|
+
export * from "@deepkit/type-compiler/config"
|
|
8
|
+
|
|
9
|
+
//#region ../deepkit/src/vendor/type-compiler/index.ts
|
|
10
|
+
var type_compiler_exports = {};
|
|
11
|
+
import * as import___deepkit_type_compiler from "@deepkit/type-compiler";
|
|
12
|
+
__reExport(type_compiler_exports, import___deepkit_type_compiler);
|
|
13
|
+
import * as import___deepkit_type_compiler_compiler from "@deepkit/type-compiler/compiler";
|
|
14
|
+
__reExport(type_compiler_exports, import___deepkit_type_compiler_compiler);
|
|
15
|
+
import * as import___deepkit_type_compiler_config from "@deepkit/type-compiler/config";
|
|
16
|
+
__reExport(type_compiler_exports, import___deepkit_type_compiler_config);
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { type_compiler_exports };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
Object.defineProperty(exports
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_transformer = require('./deepkit/src/transformer.cjs');
|
|
4
|
+
const require_index = require('./plugin-tsc/src/index.cjs');
|
|
5
|
+
let __stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
6
|
+
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* Deepkit plugin for Powerlines.
|
|
10
|
+
*
|
|
11
|
+
* @param options - The Deepkit plugin user configuration options.
|
|
12
|
+
* @returns A Powerlines plugin that integrates Deepkit transformations.
|
|
13
|
+
*/
|
|
14
|
+
const plugin = (options = {}) => {
|
|
15
|
+
return [require_index.default(options), {
|
|
16
|
+
name: "deepkit",
|
|
17
|
+
config() {
|
|
18
|
+
return {
|
|
19
|
+
transform: { deepkit: options ?? {} },
|
|
20
|
+
build: {
|
|
21
|
+
alias: {
|
|
22
|
+
"@deepkit/core": "@powerlines/deepkit/vendor/core",
|
|
23
|
+
"@deepkit/type": "@powerlines/deepkit/vendor/type",
|
|
24
|
+
"@deepkit/type-spec": "@powerlines/deepkit/vendor/type-spec",
|
|
25
|
+
"@deepkit/type-compiler": "@powerlines/deepkit/vendor/type-compiler",
|
|
26
|
+
"@deepkit/type-compiler/compiler": "@powerlines/deepkit/vendor/type-compiler/compiler",
|
|
27
|
+
"@deepkit/type-compiler/config": "@powerlines/deepkit/vendor/type-compiler/config"
|
|
28
|
+
},
|
|
29
|
+
external: ["@powerlines/deepkit"]
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
configResolved: {
|
|
34
|
+
order: "post",
|
|
35
|
+
async handler() {
|
|
36
|
+
const reflection = this.config.transform.deepkit.reflection || this.tsconfig.tsconfigJson.compilerOptions?.reflection || this.tsconfig.tsconfigJson.reflection || "default";
|
|
37
|
+
const reflectionLevel = this.config.transform.deepkit.reflectionLevel || this.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || this.tsconfig.tsconfigJson.reflectionLevel || "minimal";
|
|
38
|
+
if (!this.tsconfig.tsconfigJson.reflection || !this.tsconfig.tsconfigJson.reflectionLevel) {
|
|
39
|
+
this.tsconfig.tsconfigJson.reflection ??= reflection;
|
|
40
|
+
this.tsconfig.tsconfigJson.reflectionLevel ??= reflectionLevel;
|
|
41
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
42
|
+
}
|
|
43
|
+
this.config.transform.tsc ??= {};
|
|
44
|
+
this.config.transform.tsc.compilerOptions = {
|
|
45
|
+
...this.config.transform.tsc.compilerOptions ?? {},
|
|
46
|
+
exclude: this.config.transform.deepkit.exclude ?? [],
|
|
47
|
+
reflection,
|
|
48
|
+
reflectionLevel
|
|
49
|
+
};
|
|
50
|
+
this.config.transform.tsc.transformers ??= {
|
|
51
|
+
before: [],
|
|
52
|
+
after: []
|
|
53
|
+
};
|
|
54
|
+
this.config.transform.tsc.transformers.before.push(require_transformer.createTransformer(this, this.config.transform.deepkit));
|
|
55
|
+
this.config.transform.tsc.transformers.after.push(require_transformer.createDeclarationTransformer(this, this.config.transform.deepkit));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}];
|
|
59
|
+
};
|
|
60
|
+
var src_default = plugin;
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.default = src_default;
|
|
64
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
import{createDeclarationTransformer
|
|
1
|
+
import { createDeclarationTransformer, createTransformer } from "./deepkit/src/transformer.mjs";
|
|
2
|
+
import src_default$1 from "./plugin-tsc/src/index.mjs";
|
|
3
|
+
import { StormJSON } from "@stryke/json/storm-json";
|
|
4
|
+
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Deepkit plugin for Powerlines.
|
|
8
|
+
*
|
|
9
|
+
* @param options - The Deepkit plugin user configuration options.
|
|
10
|
+
* @returns A Powerlines plugin that integrates Deepkit transformations.
|
|
11
|
+
*/
|
|
12
|
+
const plugin = (options = {}) => {
|
|
13
|
+
return [src_default$1(options), {
|
|
14
|
+
name: "deepkit",
|
|
15
|
+
config() {
|
|
16
|
+
return {
|
|
17
|
+
transform: { deepkit: options ?? {} },
|
|
18
|
+
build: {
|
|
19
|
+
alias: {
|
|
20
|
+
"@deepkit/core": "@powerlines/deepkit/vendor/core",
|
|
21
|
+
"@deepkit/type": "@powerlines/deepkit/vendor/type",
|
|
22
|
+
"@deepkit/type-spec": "@powerlines/deepkit/vendor/type-spec",
|
|
23
|
+
"@deepkit/type-compiler": "@powerlines/deepkit/vendor/type-compiler",
|
|
24
|
+
"@deepkit/type-compiler/compiler": "@powerlines/deepkit/vendor/type-compiler/compiler",
|
|
25
|
+
"@deepkit/type-compiler/config": "@powerlines/deepkit/vendor/type-compiler/config"
|
|
26
|
+
},
|
|
27
|
+
external: ["@powerlines/deepkit"]
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
configResolved: {
|
|
32
|
+
order: "post",
|
|
33
|
+
async handler() {
|
|
34
|
+
const reflection = this.config.transform.deepkit.reflection || this.tsconfig.tsconfigJson.compilerOptions?.reflection || this.tsconfig.tsconfigJson.reflection || "default";
|
|
35
|
+
const reflectionLevel = this.config.transform.deepkit.reflectionLevel || this.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || this.tsconfig.tsconfigJson.reflectionLevel || "minimal";
|
|
36
|
+
if (!this.tsconfig.tsconfigJson.reflection || !this.tsconfig.tsconfigJson.reflectionLevel) {
|
|
37
|
+
this.tsconfig.tsconfigJson.reflection ??= reflection;
|
|
38
|
+
this.tsconfig.tsconfigJson.reflectionLevel ??= reflectionLevel;
|
|
39
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
40
|
+
}
|
|
41
|
+
this.config.transform.tsc ??= {};
|
|
42
|
+
this.config.transform.tsc.compilerOptions = {
|
|
43
|
+
...this.config.transform.tsc.compilerOptions ?? {},
|
|
44
|
+
exclude: this.config.transform.deepkit.exclude ?? [],
|
|
45
|
+
reflection,
|
|
46
|
+
reflectionLevel
|
|
47
|
+
};
|
|
48
|
+
this.config.transform.tsc.transformers ??= {
|
|
49
|
+
before: [],
|
|
50
|
+
after: []
|
|
51
|
+
};
|
|
52
|
+
this.config.transform.tsc.transformers.before.push(createTransformer(this, this.config.transform.deepkit));
|
|
53
|
+
this.config.transform.tsc.transformers.after.push(createDeclarationTransformer(this, this.config.transform.deepkit));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}];
|
|
57
|
+
};
|
|
58
|
+
var src_default = plugin;
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { src_default as default, plugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_type_check = require('./type-check.cjs');
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let typescript = require("typescript");
|
|
3
|
+
|
|
4
|
+
//#region ../plugin-tsc/src/helpers/type-check.ts
|
|
5
|
+
/**
|
|
6
|
+
* Perform type checks on the provided sources using TypeScript's compiler API.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The build context containing information about the current build.
|
|
9
|
+
*/
|
|
10
|
+
async function typeCheck(context) {
|
|
11
|
+
const result = context.program.emitToMemory();
|
|
12
|
+
const diagnosticMessages = [];
|
|
13
|
+
result.getDiagnostics().forEach((diagnostic) => {
|
|
14
|
+
if (diagnostic.getSourceFile()?.getBaseName()) diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${(0, typescript.flattenDiagnosticMessageText)(diagnostic.getMessageText().toString(), "\n")}`);
|
|
15
|
+
else diagnosticMessages.push((0, typescript.flattenDiagnosticMessageText)(diagnostic.getMessageText().toString(), "\n"));
|
|
16
|
+
});
|
|
17
|
+
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
18
|
+
if (diagnosticMessage) throw new Error(`TypeScript compilation failed: \n\n${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.typeCheck = typeCheck;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import{flattenDiagnosticMessageText
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { flattenDiagnosticMessageText } from "typescript";
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-tsc/src/helpers/type-check.ts
|
|
4
|
+
/**
|
|
5
|
+
* Perform type checks on the provided sources using TypeScript's compiler API.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The build context containing information about the current build.
|
|
8
|
+
*/
|
|
9
|
+
async function typeCheck(context) {
|
|
10
|
+
const result = context.program.emitToMemory();
|
|
11
|
+
const diagnosticMessages = [];
|
|
12
|
+
result.getDiagnostics().forEach((diagnostic) => {
|
|
13
|
+
if (diagnostic.getSourceFile()?.getBaseName()) diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
|
|
14
|
+
else diagnosticMessages.push(flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
|
|
15
|
+
});
|
|
16
|
+
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
17
|
+
if (diagnosticMessage) throw new Error(`TypeScript compilation failed: \n\n${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { typeCheck };
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_type_check = require('./helpers/type-check.cjs');
|
|
3
|
+
require('./helpers/index.cjs');
|
|
4
|
+
let defu = require("defu");
|
|
5
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
6
|
+
let typescript = require("typescript");
|
|
7
|
+
typescript = require_rolldown_runtime.__toESM(typescript);
|
|
8
|
+
|
|
9
|
+
//#region ../plugin-tsc/src/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* TypeScript Compiler plugin for Powerlines.
|
|
12
|
+
*
|
|
13
|
+
* @param options - The TypeScript Compiler plugin user configuration options.
|
|
14
|
+
* @returns A Powerlines plugin that integrates TypeScript Compiler transformations.
|
|
15
|
+
*/
|
|
16
|
+
const plugin = (options = {}) => {
|
|
17
|
+
return {
|
|
18
|
+
name: "tsc",
|
|
19
|
+
config() {
|
|
20
|
+
return { transform: { tsc: (0, defu.default)(options ?? {}, { typeCheck: false }) } };
|
|
21
|
+
},
|
|
22
|
+
async lint() {
|
|
23
|
+
if (this.config.transform.tsc.typeCheck) await require_type_check.typeCheck(this);
|
|
24
|
+
},
|
|
25
|
+
async transform(code, id) {
|
|
26
|
+
const result = typescript.default.transpileModule(code, {
|
|
27
|
+
...this.config.transform.tsc,
|
|
28
|
+
compilerOptions: {
|
|
29
|
+
...this.tsconfig.options,
|
|
30
|
+
...this.config.transform.tsc.compilerOptions
|
|
31
|
+
},
|
|
32
|
+
fileName: id
|
|
33
|
+
});
|
|
34
|
+
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, {
|
|
35
|
+
getCanonicalFileName: (fileName) => typescript.default.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
|
36
|
+
getCurrentDirectory: () => typescript.default.sys.getCurrentDirectory(),
|
|
37
|
+
getNewLine: () => typescript.default.sys.newLine
|
|
38
|
+
})}`);
|
|
39
|
+
if (!result.outputText) throw new Error(`TypeScript Compiler - No output generated for file during TypeScript transpilation: ${id}`);
|
|
40
|
+
return {
|
|
41
|
+
code: result.outputText,
|
|
42
|
+
id
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var src_default = plugin;
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.default = src_default;
|
|
@@ -1 +1,47 @@
|
|
|
1
|
-
import{typeCheck
|
|
1
|
+
import { typeCheck } from "./helpers/type-check.mjs";
|
|
2
|
+
import "./helpers/index.mjs";
|
|
3
|
+
import defu from "defu";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
|
|
6
|
+
//#region ../plugin-tsc/src/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* TypeScript Compiler plugin for Powerlines.
|
|
9
|
+
*
|
|
10
|
+
* @param options - The TypeScript Compiler plugin user configuration options.
|
|
11
|
+
* @returns A Powerlines plugin that integrates TypeScript Compiler transformations.
|
|
12
|
+
*/
|
|
13
|
+
const plugin = (options = {}) => {
|
|
14
|
+
return {
|
|
15
|
+
name: "tsc",
|
|
16
|
+
config() {
|
|
17
|
+
return { transform: { tsc: defu(options ?? {}, { typeCheck: false }) } };
|
|
18
|
+
},
|
|
19
|
+
async lint() {
|
|
20
|
+
if (this.config.transform.tsc.typeCheck) await typeCheck(this);
|
|
21
|
+
},
|
|
22
|
+
async transform(code, id) {
|
|
23
|
+
const result = ts.transpileModule(code, {
|
|
24
|
+
...this.config.transform.tsc,
|
|
25
|
+
compilerOptions: {
|
|
26
|
+
...this.tsconfig.options,
|
|
27
|
+
...this.config.transform.tsc.compilerOptions
|
|
28
|
+
},
|
|
29
|
+
fileName: id
|
|
30
|
+
});
|
|
31
|
+
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, {
|
|
32
|
+
getCanonicalFileName: (fileName) => ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
|
33
|
+
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
34
|
+
getNewLine: () => ts.sys.newLine
|
|
35
|
+
})}`);
|
|
36
|
+
if (!result.outputText) throw new Error(`TypeScript Compiler - No output generated for file during TypeScript transpilation: ${id}`);
|
|
37
|
+
return {
|
|
38
|
+
code: result.outputText,
|
|
39
|
+
id
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var src_default = plugin;
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { src_default as default };
|
|
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
78
78
|
*/
|
|
79
79
|
allowReturnOutsideFunction?: boolean;
|
|
80
80
|
}
|
|
81
|
+
interface EmitOptions extends WriteOptions {
|
|
82
|
+
/**
|
|
83
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
84
|
+
*/
|
|
85
|
+
emitWithBundler?: boolean;
|
|
86
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
87
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
88
|
+
}
|
|
81
89
|
/**
|
|
82
90
|
* Options for emitting entry virtual files
|
|
83
91
|
*/
|
|
84
|
-
type EmitEntryOptions =
|
|
92
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
85
93
|
/**
|
|
86
94
|
* The unresolved Powerlines context.
|
|
87
95
|
*
|
|
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
292
300
|
* The Powerlines builtin virtual files
|
|
293
301
|
*/
|
|
294
302
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
305
|
+
*
|
|
306
|
+
* @param code - The source code of the file
|
|
307
|
+
* @param path - The path to write the file to
|
|
308
|
+
* @param options - Additional options for writing the file
|
|
309
|
+
*/
|
|
310
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
313
|
+
*
|
|
314
|
+
* @param code - The source code of the file
|
|
315
|
+
* @param path - The path to write the file to
|
|
316
|
+
* @param options - Additional options for writing the file
|
|
317
|
+
*/
|
|
318
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
295
319
|
/**
|
|
296
320
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
297
321
|
*
|
|
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
300
324
|
* @param path - An optional path to write the builtin file to
|
|
301
325
|
* @param options - Additional options for writing the builtin file
|
|
302
326
|
*/
|
|
303
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
327
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
304
328
|
/**
|
|
305
329
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
306
330
|
*
|
|
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
309
333
|
* @param path - An optional path to write the builtin file to
|
|
310
334
|
* @param options - Additional options for writing the builtin file
|
|
311
335
|
*/
|
|
312
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
336
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
313
337
|
/**
|
|
314
338
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
315
339
|
*
|
|
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
80
80
|
*/
|
|
81
81
|
allowReturnOutsideFunction?: boolean;
|
|
82
82
|
}
|
|
83
|
+
interface EmitOptions extends WriteOptions {
|
|
84
|
+
/**
|
|
85
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
86
|
+
*/
|
|
87
|
+
emitWithBundler?: boolean;
|
|
88
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
89
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
90
|
+
}
|
|
83
91
|
/**
|
|
84
92
|
* Options for emitting entry virtual files
|
|
85
93
|
*/
|
|
86
|
-
type EmitEntryOptions =
|
|
94
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
87
95
|
/**
|
|
88
96
|
* The unresolved Powerlines context.
|
|
89
97
|
*
|
|
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
294
302
|
* The Powerlines builtin virtual files
|
|
295
303
|
*/
|
|
296
304
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
307
|
+
*
|
|
308
|
+
* @param code - The source code of the file
|
|
309
|
+
* @param path - The path to write the file to
|
|
310
|
+
* @param options - Additional options for writing the file
|
|
311
|
+
*/
|
|
312
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
315
|
+
*
|
|
316
|
+
* @param code - The source code of the file
|
|
317
|
+
* @param path - The path to write the file to
|
|
318
|
+
* @param options - Additional options for writing the file
|
|
319
|
+
*/
|
|
320
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
297
321
|
/**
|
|
298
322
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
299
323
|
*
|
|
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
302
326
|
* @param path - An optional path to write the builtin file to
|
|
303
327
|
* @param options - Additional options for writing the builtin file
|
|
304
328
|
*/
|
|
305
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
329
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
306
330
|
/**
|
|
307
331
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
308
332
|
*
|
|
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
311
335
|
* @param path - An optional path to write the builtin file to
|
|
312
336
|
* @param options - Additional options for writing the builtin file
|
|
313
337
|
*/
|
|
314
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
338
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
315
339
|
/**
|
|
316
340
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
317
341
|
*
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-deepkit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.132",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -117,16 +117,16 @@
|
|
|
117
117
|
"files": ["dist/**/*"],
|
|
118
118
|
"keywords": ["deepkit", "powerlines", "storm-software", "powerlines-plugin"],
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@stryke/json": "^0.9.
|
|
121
|
-
"@powerlines/deepkit": "^0.5.
|
|
122
|
-
"@powerlines/plugin-tsc": "^0.2.
|
|
123
|
-
"powerlines": "^0.36.
|
|
120
|
+
"@stryke/json": "^0.9.33",
|
|
121
|
+
"@powerlines/deepkit": "^0.5.34",
|
|
122
|
+
"@powerlines/plugin-tsc": "^0.2.127",
|
|
123
|
+
"powerlines": "^0.36.24",
|
|
124
124
|
"typescript": "^5.9.3"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
|
-
"@powerlines/nx": "^0.11.
|
|
127
|
+
"@powerlines/nx": "^0.11.50",
|
|
128
128
|
"@types/node": "^24.10.4"
|
|
129
129
|
},
|
|
130
130
|
"publishConfig": { "access": "public" },
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "4b695d4b3476fd9dd79521f92258d52dab2b8d72"
|
|
132
132
|
}
|