@storm-software/workspace-tools 1.16.17 → 1.17.0
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/CHANGELOG.md +7 -0
- package/index.js +251 -9
- package/meta.json +1 -1
- package/package.json +2 -1
- package/src/executors/tsup/executor.js +250 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/workspace-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"main": "./index",
|
|
33
33
|
"typings": "./index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@anatine/esbuild-decorators": "^0.2.19",
|
|
35
36
|
"@microsoft/api-extractor": "^7.38.3",
|
|
36
37
|
"@nx/devkit": "17.0.3",
|
|
37
38
|
"@nx/esbuild": "17.0.3",
|
|
@@ -578,6 +578,238 @@ var init_tslib_es6 = __esm({
|
|
|
578
578
|
}
|
|
579
579
|
});
|
|
580
580
|
|
|
581
|
+
// node_modules/.pnpm/@anatine+esbuild-decorators@0.2.19_esbuild@0.14.54/node_modules/@anatine/esbuild-decorators/src/lib/strip-it.js
|
|
582
|
+
var require_strip_it = __commonJS({
|
|
583
|
+
"node_modules/.pnpm/@anatine+esbuild-decorators@0.2.19_esbuild@0.14.54/node_modules/@anatine/esbuild-decorators/src/lib/strip-it.js"(exports) {
|
|
584
|
+
"use strict";
|
|
585
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
586
|
+
exports.strip = void 0;
|
|
587
|
+
var TextNode = class {
|
|
588
|
+
constructor(node) {
|
|
589
|
+
this.type = node.type;
|
|
590
|
+
this.value = node.value;
|
|
591
|
+
this.match = node.match;
|
|
592
|
+
this.newline = node.newline || "";
|
|
593
|
+
}
|
|
594
|
+
get protected() {
|
|
595
|
+
return Boolean(this.match) && this.match[1] === "!";
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
var TextBlock = class extends TextNode {
|
|
599
|
+
constructor(node) {
|
|
600
|
+
super(node);
|
|
601
|
+
this.nodes = node.nodes || [];
|
|
602
|
+
}
|
|
603
|
+
push(node) {
|
|
604
|
+
this.nodes.push(node);
|
|
605
|
+
}
|
|
606
|
+
get protected() {
|
|
607
|
+
return this.nodes.length > 0 && this.nodes[0].protected === true;
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
var constants2 = {
|
|
611
|
+
ESCAPED_CHAR_REGEX: /^\\./,
|
|
612
|
+
QUOTED_STRING_REGEX: /^(['"`])((?:\\.|[^\1])+?)(\1)/,
|
|
613
|
+
NEWLINE_REGEX: /^\r*\n/,
|
|
614
|
+
BLOCK_OPEN_REGEX: /^\/\*\*?(!?)/,
|
|
615
|
+
BLOCK_CLOSE_REGEX: /^\*\/(\n?)/,
|
|
616
|
+
LINE_REGEX: /^\/\/(!?).*/
|
|
617
|
+
};
|
|
618
|
+
var parse = (input) => {
|
|
619
|
+
const cst = new TextBlock({ type: "root", nodes: [] });
|
|
620
|
+
const stack = [cst];
|
|
621
|
+
const { ESCAPED_CHAR_REGEX, QUOTED_STRING_REGEX, NEWLINE_REGEX, BLOCK_CLOSE_REGEX, BLOCK_OPEN_REGEX, LINE_REGEX } = constants2;
|
|
622
|
+
let block = cst;
|
|
623
|
+
let remaining = input;
|
|
624
|
+
let token;
|
|
625
|
+
let prev;
|
|
626
|
+
const consume = (value = remaining[0] || "") => {
|
|
627
|
+
remaining = remaining.slice(value.length);
|
|
628
|
+
return value;
|
|
629
|
+
};
|
|
630
|
+
const scan = (regex, type = "text") => {
|
|
631
|
+
const match2 = regex.exec(remaining);
|
|
632
|
+
if (match2) {
|
|
633
|
+
consume(match2[0]);
|
|
634
|
+
return { type, value: match2[0], match: match2 };
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
const push = (node) => {
|
|
638
|
+
if (prev && prev.type === "text" && node.type === "text") {
|
|
639
|
+
prev.value += node.value;
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
block.push(node);
|
|
643
|
+
if (node.nodes) {
|
|
644
|
+
stack.push(node);
|
|
645
|
+
block = node;
|
|
646
|
+
}
|
|
647
|
+
prev = node;
|
|
648
|
+
};
|
|
649
|
+
const pop = () => {
|
|
650
|
+
if (block.type === "root") {
|
|
651
|
+
throw new SyntaxError("Unclosed block comment");
|
|
652
|
+
}
|
|
653
|
+
stack.pop();
|
|
654
|
+
block = stack[stack.length - 1];
|
|
655
|
+
};
|
|
656
|
+
while (remaining !== "") {
|
|
657
|
+
if (token = scan(ESCAPED_CHAR_REGEX, "text")) {
|
|
658
|
+
push(new TextNode(token));
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (block.type !== "block" && (!prev || !/\w$/.test(prev.value))) {
|
|
662
|
+
if (token = scan(QUOTED_STRING_REGEX, "line")) {
|
|
663
|
+
push(new TextNode(token));
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (token = scan(NEWLINE_REGEX, "newline")) {
|
|
668
|
+
push(new TextNode(token));
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
if (token = scan(BLOCK_OPEN_REGEX, "open")) {
|
|
672
|
+
push(new TextBlock({ type: "block" }));
|
|
673
|
+
push(new TextNode(token));
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
if (block.type === "block") {
|
|
677
|
+
if (token = scan(BLOCK_CLOSE_REGEX, "close")) {
|
|
678
|
+
token.newline = token.match[1] || "";
|
|
679
|
+
push(new TextNode(token));
|
|
680
|
+
pop();
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (block.type !== "block") {
|
|
685
|
+
if (token = scan(LINE_REGEX, "line")) {
|
|
686
|
+
push(new TextNode(token));
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
push(new TextNode({ type: "text", value: consume(remaining[0]) }));
|
|
691
|
+
}
|
|
692
|
+
return cst;
|
|
693
|
+
};
|
|
694
|
+
var compile = (cst) => {
|
|
695
|
+
const walk = (node) => {
|
|
696
|
+
let output = "";
|
|
697
|
+
for (const child of node.nodes) {
|
|
698
|
+
switch (child.type) {
|
|
699
|
+
case "block":
|
|
700
|
+
break;
|
|
701
|
+
case "line":
|
|
702
|
+
break;
|
|
703
|
+
case "open":
|
|
704
|
+
case "close":
|
|
705
|
+
case "text":
|
|
706
|
+
case "newline":
|
|
707
|
+
default: {
|
|
708
|
+
output += child.value || "";
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return output;
|
|
714
|
+
};
|
|
715
|
+
return walk(cst);
|
|
716
|
+
};
|
|
717
|
+
var strip = (input) => compile(parse(input));
|
|
718
|
+
exports.strip = strip;
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// node_modules/.pnpm/@anatine+esbuild-decorators@0.2.19_esbuild@0.14.54/node_modules/@anatine/esbuild-decorators/src/lib/esbuild-decorators.js
|
|
723
|
+
var require_esbuild_decorators = __commonJS({
|
|
724
|
+
"node_modules/.pnpm/@anatine+esbuild-decorators@0.2.19_esbuild@0.14.54/node_modules/@anatine/esbuild-decorators/src/lib/esbuild-decorators.js"(exports) {
|
|
725
|
+
"use strict";
|
|
726
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
727
|
+
exports.esbuildDecorators = void 0;
|
|
728
|
+
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
729
|
+
var fs_1 = require("fs");
|
|
730
|
+
var path_1 = require("path");
|
|
731
|
+
var typescript_1 = require("typescript");
|
|
732
|
+
var util_1 = require("util");
|
|
733
|
+
var strip_it_1 = require_strip_it();
|
|
734
|
+
var { readFile } = fs_1.promises;
|
|
735
|
+
var theFinder = new RegExp(/((?<![(\s]\s*['"])@\w[.[\]\w\d]*\s*(?![;])[((?=\s)])/);
|
|
736
|
+
var findDecorators = (fileContent) => theFinder.test((0, strip_it_1.strip)(fileContent));
|
|
737
|
+
var esbuildDecorators2 = (options = {}) => ({
|
|
738
|
+
name: "tsc",
|
|
739
|
+
setup(build2) {
|
|
740
|
+
var _a, _b, _c;
|
|
741
|
+
const cwd = options.cwd || process.cwd();
|
|
742
|
+
const tsconfigPath = options.tsconfig || ((_a = build2.initialOptions) === null || _a === void 0 ? void 0 : _a.tsconfig) || (0, path_1.join)(cwd, "./tsconfig.json");
|
|
743
|
+
const forceTsc = (_b = options.force) !== null && _b !== void 0 ? _b : false;
|
|
744
|
+
const tsx = (_c = options.tsx) !== null && _c !== void 0 ? _c : true;
|
|
745
|
+
let parsedTsConfig = null;
|
|
746
|
+
build2.onLoad({ filter: tsx ? /\.tsx?$/ : /\.ts$/ }, (args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
747
|
+
if (!parsedTsConfig) {
|
|
748
|
+
parsedTsConfig = parseTsConfig(tsconfigPath, cwd);
|
|
749
|
+
if (parsedTsConfig.options.sourcemap) {
|
|
750
|
+
parsedTsConfig.options.sourcemap = false;
|
|
751
|
+
parsedTsConfig.options.inlineSources = true;
|
|
752
|
+
parsedTsConfig.options.inlineSourceMap = true;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
if (!forceTsc && (!parsedTsConfig || !parsedTsConfig.options || !parsedTsConfig.options.emitDecoratorMetadata)) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
const ts2 = yield readFile(args.path, "utf8").catch((err) => printDiagnostics({ file: args.path, err }));
|
|
759
|
+
const hasDecorator = findDecorators(ts2);
|
|
760
|
+
if (!ts2 || !hasDecorator) {
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
const program = (0, typescript_1.transpileModule)(ts2, {
|
|
764
|
+
compilerOptions: parsedTsConfig.options
|
|
765
|
+
});
|
|
766
|
+
return { contents: program.outputText };
|
|
767
|
+
}));
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
exports.esbuildDecorators = esbuildDecorators2;
|
|
771
|
+
function parseTsConfig(tsconfig, cwd = process.cwd()) {
|
|
772
|
+
const fileName = (0, typescript_1.findConfigFile)(cwd, typescript_1.sys.fileExists, tsconfig);
|
|
773
|
+
if (tsconfig !== void 0 && !fileName)
|
|
774
|
+
throw new Error(`failed to open '${fileName}'`);
|
|
775
|
+
let loadedConfig = {};
|
|
776
|
+
let baseDir = cwd;
|
|
777
|
+
if (fileName) {
|
|
778
|
+
const text = typescript_1.sys.readFile(fileName);
|
|
779
|
+
if (text === void 0)
|
|
780
|
+
throw new Error(`failed to read '${fileName}'`);
|
|
781
|
+
const result = (0, typescript_1.parseConfigFileTextToJson)(fileName, text);
|
|
782
|
+
if (result.error !== void 0) {
|
|
783
|
+
printDiagnostics(result.error);
|
|
784
|
+
throw new Error(`failed to parse '${fileName}'`);
|
|
785
|
+
}
|
|
786
|
+
loadedConfig = result.config;
|
|
787
|
+
baseDir = (0, path_1.dirname)(fileName);
|
|
788
|
+
}
|
|
789
|
+
const parsedTsConfig = (0, typescript_1.parseJsonConfigFileContent)(loadedConfig, typescript_1.sys, baseDir);
|
|
790
|
+
if (parsedTsConfig.errors[0])
|
|
791
|
+
printDiagnostics(parsedTsConfig.errors);
|
|
792
|
+
return parsedTsConfig;
|
|
793
|
+
}
|
|
794
|
+
function printDiagnostics(...args) {
|
|
795
|
+
console.log((0, util_1.inspect)(args, false, 10, true));
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// node_modules/.pnpm/@anatine+esbuild-decorators@0.2.19_esbuild@0.14.54/node_modules/@anatine/esbuild-decorators/src/index.js
|
|
801
|
+
var require_src = __commonJS({
|
|
802
|
+
"node_modules/.pnpm/@anatine+esbuild-decorators@0.2.19_esbuild@0.14.54/node_modules/@anatine/esbuild-decorators/src/index.js"(exports) {
|
|
803
|
+
"use strict";
|
|
804
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
805
|
+
exports.esbuildDecorators = void 0;
|
|
806
|
+
var esbuild_decorators_1 = require_esbuild_decorators();
|
|
807
|
+
Object.defineProperty(exports, "esbuildDecorators", { enumerable: true, get: function() {
|
|
808
|
+
return esbuild_decorators_1.esbuildDecorators;
|
|
809
|
+
} });
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
|
|
581
813
|
// node_modules/.pnpm/@nx+devkit@17.0.3_nx@17.0.3/node_modules/@nx/devkit/nx.js
|
|
582
814
|
var require_nx = __commonJS({
|
|
583
815
|
"node_modules/.pnpm/@nx+devkit@17.0.3_nx@17.0.3/node_modules/@nx/devkit/nx.js"(exports) {
|
|
@@ -18232,9 +18464,9 @@ var require_devkit = __commonJS({
|
|
|
18232
18464
|
}
|
|
18233
18465
|
});
|
|
18234
18466
|
|
|
18235
|
-
// node_modules/.pnpm/@nx+esbuild@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.8.10_esbuild@0.
|
|
18467
|
+
// node_modules/.pnpm/@nx+esbuild@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.8.10_esbuild@0.14_jlzadk2xcsikuhpeek3jtu6zra/node_modules/@nx/esbuild/src/executors/esbuild/lib/get-extra-dependencies.js
|
|
18236
18468
|
var require_get_extra_dependencies = __commonJS({
|
|
18237
|
-
"node_modules/.pnpm/@nx+esbuild@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.8.10_esbuild@0.
|
|
18469
|
+
"node_modules/.pnpm/@nx+esbuild@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.8.10_esbuild@0.14_jlzadk2xcsikuhpeek3jtu6zra/node_modules/@nx/esbuild/src/executors/esbuild/lib/get-extra-dependencies.js"(exports) {
|
|
18238
18470
|
"use strict";
|
|
18239
18471
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18240
18472
|
exports.getExtraDependencies = void 0;
|
|
@@ -37234,7 +37466,7 @@ var require_library = __commonJS({
|
|
|
37234
37466
|
});
|
|
37235
37467
|
|
|
37236
37468
|
// node_modules/.pnpm/@nx+js@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.8.10_nx@17.0.3_typescript@5.2.2_verdaccio@5.27.0/node_modules/@nx/js/src/index.js
|
|
37237
|
-
var
|
|
37469
|
+
var require_src2 = __commonJS({
|
|
37238
37470
|
"node_modules/.pnpm/@nx+js@17.0.3_@swc-node+register@1.6.8_@swc+core@1.3.96_@types+node@20.8.10_nx@17.0.3_typescript@5.2.2_verdaccio@5.27.0/node_modules/@nx/js/src/index.js"(exports) {
|
|
37239
37471
|
"use strict";
|
|
37240
37472
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -98354,9 +98586,10 @@ __export(executor_exports, {
|
|
|
98354
98586
|
tsupExecutor: () => tsupExecutor
|
|
98355
98587
|
});
|
|
98356
98588
|
module.exports = __toCommonJS(executor_exports);
|
|
98589
|
+
var import_esbuild_decorators = __toESM(require_src());
|
|
98357
98590
|
var import_devkit = __toESM(require_devkit());
|
|
98358
98591
|
var import_get_extra_dependencies = __toESM(require_get_extra_dependencies());
|
|
98359
|
-
var import_js = __toESM(
|
|
98592
|
+
var import_js = __toESM(require_src2());
|
|
98360
98593
|
var import_normalize_options = __toESM(require_normalize_options());
|
|
98361
98594
|
var import_tsc = __toESM(require_tsc_impl());
|
|
98362
98595
|
var import_decky = __toESM(require_decky());
|
|
@@ -105207,7 +105440,7 @@ ${externalDependencies.map((dep) => {
|
|
|
105207
105440
|
files.map(
|
|
105208
105441
|
(file) => (0, import_promises2.writeFile)(
|
|
105209
105442
|
file,
|
|
105210
|
-
`// ${options.banner}
|
|
105443
|
+
`${options.banner.startsWith("//") ? options.banner : `// ${options.banner}`}
|
|
105211
105444
|
|
|
105212
105445
|
${(0, import_fs2.readFileSync)(file, "utf-8")}`,
|
|
105213
105446
|
"utf-8"
|
|
@@ -105216,6 +105449,12 @@ ${(0, import_fs2.readFileSync)(file, "utf-8")}`,
|
|
|
105216
105449
|
);
|
|
105217
105450
|
}
|
|
105218
105451
|
options.plugins.push(await (0, import_decky.load)());
|
|
105452
|
+
options.plugins.push(
|
|
105453
|
+
(0, import_esbuild_decorators.esbuildDecorators)({
|
|
105454
|
+
tsconfig: options.tsConfig,
|
|
105455
|
+
cwd: workspaceRoot
|
|
105456
|
+
})
|
|
105457
|
+
);
|
|
105219
105458
|
const eventEmitter = new import_node_events.EventEmitter({ captureRejections: true });
|
|
105220
105459
|
eventEmitter.on("message", (event) => {
|
|
105221
105460
|
console.log(`\u{1F4E2} Tsup build message:
|
|
@@ -105241,11 +105480,14 @@ ${(0, import_fs2.readFileSync)(file, "utf-8")}`,
|
|
|
105241
105480
|
context
|
|
105242
105481
|
)
|
|
105243
105482
|
),
|
|
105244
|
-
banner: options.banner ? {
|
|
105483
|
+
banner: options.banner ? {
|
|
105484
|
+
js: `${options.banner.startsWith("//") ? options.banner : `// ${options.banner}`}
|
|
105245
105485
|
|
|
105246
|
-
`,
|
|
105486
|
+
`,
|
|
105487
|
+
css: `/* ${options.banner.startsWith("//") ? options.banner.replace("//", "") : options.banner} */
|
|
105247
105488
|
|
|
105248
|
-
`
|
|
105489
|
+
`
|
|
105490
|
+
} : void 0,
|
|
105249
105491
|
outputPath
|
|
105250
105492
|
});
|
|
105251
105493
|
if (typeof config === "function") {
|