@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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.16.17](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.16.16...workspace-tools-v1.16.17) (2023-11-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **workspace-tools:** Update input file path for api-extractor ([7750f15](https://github.com/storm-software/storm-ops/commit/7750f151de20da36ab72c0b7f98df415c833704a))
|
|
7
|
+
|
|
1
8
|
## [1.16.16](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.16.15...workspace-tools-v1.16.16) (2023-11-30)
|
|
2
9
|
|
|
3
10
|
|
package/index.js
CHANGED
|
@@ -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 });
|
|
@@ -98376,9 +98608,10 @@ __export(workspace_tools_exports, {
|
|
|
98376
98608
|
module.exports = __toCommonJS(workspace_tools_exports);
|
|
98377
98609
|
|
|
98378
98610
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
98611
|
+
var import_esbuild_decorators = __toESM(require_src());
|
|
98379
98612
|
var import_devkit = __toESM(require_devkit());
|
|
98380
98613
|
var import_get_extra_dependencies = __toESM(require_get_extra_dependencies());
|
|
98381
|
-
var import_js = __toESM(
|
|
98614
|
+
var import_js = __toESM(require_src2());
|
|
98382
98615
|
var import_normalize_options = __toESM(require_normalize_options());
|
|
98383
98616
|
var import_tsc = __toESM(require_tsc_impl());
|
|
98384
98617
|
var import_decky = __toESM(require_decky());
|
|
@@ -105249,7 +105482,7 @@ ${externalDependencies.map((dep) => {
|
|
|
105249
105482
|
files.map(
|
|
105250
105483
|
(file) => (0, import_promises2.writeFile)(
|
|
105251
105484
|
file,
|
|
105252
|
-
`// ${options.banner}
|
|
105485
|
+
`${options.banner.startsWith("//") ? options.banner : `// ${options.banner}`}
|
|
105253
105486
|
|
|
105254
105487
|
${(0, import_fs2.readFileSync)(file, "utf-8")}`,
|
|
105255
105488
|
"utf-8"
|
|
@@ -105258,6 +105491,12 @@ ${(0, import_fs2.readFileSync)(file, "utf-8")}`,
|
|
|
105258
105491
|
);
|
|
105259
105492
|
}
|
|
105260
105493
|
options.plugins.push(await (0, import_decky.load)());
|
|
105494
|
+
options.plugins.push(
|
|
105495
|
+
(0, import_esbuild_decorators.esbuildDecorators)({
|
|
105496
|
+
tsconfig: options.tsConfig,
|
|
105497
|
+
cwd: workspaceRoot
|
|
105498
|
+
})
|
|
105499
|
+
);
|
|
105261
105500
|
const eventEmitter = new import_node_events.EventEmitter({ captureRejections: true });
|
|
105262
105501
|
eventEmitter.on("message", (event) => {
|
|
105263
105502
|
console.log(`\u{1F4E2} Tsup build message:
|
|
@@ -105283,11 +105522,14 @@ ${(0, import_fs2.readFileSync)(file, "utf-8")}`,
|
|
|
105283
105522
|
context
|
|
105284
105523
|
)
|
|
105285
105524
|
),
|
|
105286
|
-
banner: options.banner ? {
|
|
105525
|
+
banner: options.banner ? {
|
|
105526
|
+
js: `${options.banner.startsWith("//") ? options.banner : `// ${options.banner}`}
|
|
105287
105527
|
|
|
105288
|
-
`,
|
|
105528
|
+
`,
|
|
105529
|
+
css: `/* ${options.banner.startsWith("//") ? options.banner.replace("//", "") : options.banner} */
|
|
105289
105530
|
|
|
105290
|
-
`
|
|
105531
|
+
`
|
|
105532
|
+
} : void 0,
|
|
105291
105533
|
outputPath
|
|
105292
105534
|
});
|
|
105293
105535
|
if (typeof config === "function") {
|
|
@@ -105374,7 +105616,7 @@ async function stormInitGenerator(tree, schema) {
|
|
|
105374
105616
|
|
|
105375
105617
|
// packages/workspace-tools/src/generators/node-library/generator.ts
|
|
105376
105618
|
var import_devkit4 = __toESM(require_devkit());
|
|
105377
|
-
var import_js2 = __toESM(
|
|
105619
|
+
var import_js2 = __toESM(require_src2());
|
|
105378
105620
|
var import_init = __toESM(require_init());
|
|
105379
105621
|
var import_generator = __toESM(require_generator());
|
|
105380
105622
|
|