@simplysm/sd-cli 12.13.19 → 12.13.21
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/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +1 -0
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +16 -11
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -1
- package/dist/pkg-builders/client/sd-client.build-runner.js +7 -17
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js +105 -95
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js +68 -57
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -1
- package/dist/pkg-builders/commons/build-runner.base.d.ts +2 -1
- package/dist/pkg-builders/commons/build-runner.base.js +16 -27
- package/dist/pkg-builders/commons/build-runner.base.js.map +1 -1
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.d.ts +1 -0
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js +21 -11
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js.map +1 -1
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +1 -0
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +13 -10
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +11 -30
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.bundler.js +48 -37
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
- package/dist/ts-compiler/sd-ts-compiler.js +116 -222
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -1
- package/package.json +5 -5
- package/src/pkg-builders/client/sd-cli-ng-routes.file-generator.ts +18 -8
- package/src/pkg-builders/client/sd-client.build-runner.ts +8 -19
- package/src/pkg-builders/client/sd-ng.bundler.ts +139 -121
- package/src/pkg-builders/client/sd-ng.plugin-creator.ts +22 -17
- package/src/pkg-builders/commons/build-runner.base.ts +62 -75
- package/src/pkg-builders/lib/sd-cli-db-context.file-generator.ts +20 -8
- package/src/pkg-builders/lib/sd-cli-index.file-generator.ts +20 -9
- package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +11 -31
- package/src/pkg-builders/server/sd-server.bundler.ts +59 -48
- package/src/ts-compiler/sd-ts-compiler.ts +19 -160
|
@@ -171,7 +171,7 @@ export class SdTsCompiler {
|
|
|
171
171
|
context.resourceFile != null ? PathUtils.norm(context.resourceFile) : undefined,
|
|
172
172
|
);
|
|
173
173
|
|
|
174
|
-
if (!styleBundleResult.cached && !StringUtils.isNullOrEmpty(styleBundleResult.contents)) {
|
|
174
|
+
/*if (!styleBundleResult.cached && !StringUtils.isNullOrEmpty(styleBundleResult.contents)) {
|
|
175
175
|
const relPath = path.relative(
|
|
176
176
|
path.resolve(this._opt.pkgPath, "src"),
|
|
177
177
|
context.containingFile,
|
|
@@ -186,11 +186,11 @@ export class SdTsCompiler {
|
|
|
186
186
|
);
|
|
187
187
|
cache.remove((item) => item.outAbsPath === outAbsPath);
|
|
188
188
|
cache.push({ outAbsPath, text: styleBundleResult.contents });
|
|
189
|
-
}
|
|
189
|
+
}*/
|
|
190
190
|
|
|
191
191
|
return StringUtils.isNullOrEmpty(styleBundleResult.contents)
|
|
192
192
|
? null
|
|
193
|
-
: { content:
|
|
193
|
+
: { content: styleBundleResult.contents };
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -508,7 +508,7 @@ export class SdTsCompiler {
|
|
|
508
508
|
}),
|
|
509
509
|
);
|
|
510
510
|
|
|
511
|
-
(transformers.before ??= []).push(this.#createExternalizeComponentStylesTransformer());
|
|
511
|
+
// (transformers.before ??= []).push(this.#createExternalizeComponentStylesTransformer());
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
this.#debug(`파일 출력 중...`);
|
|
@@ -517,8 +517,8 @@ export class SdTsCompiler {
|
|
|
517
517
|
// 비교해보니, 딱히 getSourceFiles라서 더 느려지는것 같지는 않음
|
|
518
518
|
// 그래도 affected로 다시 테스트 (조금이라도 더 빠르게)
|
|
519
519
|
for (const affectedFile of [
|
|
520
|
-
...prepareResult.affectedFileSet
|
|
521
|
-
|
|
520
|
+
...prepareResult.affectedFileSet,
|
|
521
|
+
...prepareResult.styleAffectedFileSet,
|
|
522
522
|
]) {
|
|
523
523
|
if (
|
|
524
524
|
this.#emittedFilesCacheMap
|
|
@@ -595,168 +595,27 @@ export class SdTsCompiler {
|
|
|
595
595
|
};
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
-
|
|
598
|
+
/*#createExternalizeComponentStylesTransformer() {
|
|
599
599
|
const f = ts.factory;
|
|
600
600
|
|
|
601
|
-
/*function makeEnsureStyleFunc() {
|
|
602
|
-
// function __sdEnsureStyle(href) { ... }
|
|
603
|
-
const hrefParam = f.createParameterDeclaration(undefined, undefined, "href");
|
|
604
|
-
|
|
605
|
-
// const d = document;
|
|
606
|
-
const declD = f.createVariableStatement(
|
|
607
|
-
undefined,
|
|
608
|
-
f.createVariableDeclarationList(
|
|
609
|
-
[f.createVariableDeclaration("d", undefined, undefined, f.createIdentifier("document"))],
|
|
610
|
-
ts.NodeFlags.Const,
|
|
611
|
-
),
|
|
612
|
-
);
|
|
613
|
-
|
|
614
|
-
// let link = d.querySelector(`link[data-sd-style="${href}"]`);
|
|
615
|
-
const tpl = f.createTemplateExpression(f.createTemplateHead('link[data-sd-style="'), [
|
|
616
|
-
f.createTemplateSpan(f.createIdentifier("href"), f.createTemplateTail('"]')),
|
|
617
|
-
]);
|
|
618
|
-
const declLink = f.createVariableStatement(
|
|
619
|
-
undefined,
|
|
620
|
-
f.createVariableDeclarationList(
|
|
621
|
-
[
|
|
622
|
-
f.createVariableDeclaration(
|
|
623
|
-
"link",
|
|
624
|
-
undefined,
|
|
625
|
-
undefined,
|
|
626
|
-
f.createCallExpression(
|
|
627
|
-
f.createPropertyAccessExpression(f.createIdentifier("d"), "querySelector"),
|
|
628
|
-
undefined,
|
|
629
|
-
[tpl],
|
|
630
|
-
),
|
|
631
|
-
),
|
|
632
|
-
],
|
|
633
|
-
ts.NodeFlags.Let,
|
|
634
|
-
),
|
|
635
|
-
);
|
|
636
|
-
|
|
637
|
-
// if (link) return;
|
|
638
|
-
const ifReturn = f.createIfStatement(
|
|
639
|
-
f.createIdentifier("link"),
|
|
640
|
-
f.createBlock([f.createReturnStatement()], true),
|
|
641
|
-
);
|
|
642
|
-
|
|
643
|
-
// link = d.createElement('link');
|
|
644
|
-
const mkLink = f.createExpressionStatement(
|
|
645
|
-
f.createBinaryExpression(
|
|
646
|
-
f.createIdentifier("link"),
|
|
647
|
-
ts.SyntaxKind.EqualsToken,
|
|
648
|
-
f.createCallExpression(
|
|
649
|
-
f.createPropertyAccessExpression(f.createIdentifier("d"), "createElement"),
|
|
650
|
-
undefined,
|
|
651
|
-
[f.createStringLiteral("link")],
|
|
652
|
-
),
|
|
653
|
-
),
|
|
654
|
-
);
|
|
655
|
-
|
|
656
|
-
// link.rel = 'stylesheet';
|
|
657
|
-
const setRel = f.createExpressionStatement(
|
|
658
|
-
f.createBinaryExpression(
|
|
659
|
-
f.createPropertyAccessExpression(f.createIdentifier("link"), "rel"),
|
|
660
|
-
ts.SyntaxKind.EqualsToken,
|
|
661
|
-
f.createStringLiteral("stylesheet"),
|
|
662
|
-
),
|
|
663
|
-
);
|
|
664
|
-
|
|
665
|
-
// link.setAttribute('data-sd-style', href);
|
|
666
|
-
const setData = f.createExpressionStatement(
|
|
667
|
-
f.createCallExpression(
|
|
668
|
-
f.createPropertyAccessExpression(f.createIdentifier("link"), "setAttribute"),
|
|
669
|
-
undefined,
|
|
670
|
-
[f.createStringLiteral("data-sd-style"), f.createIdentifier("href")],
|
|
671
|
-
),
|
|
672
|
-
);
|
|
673
|
-
|
|
674
|
-
// link.href = href;
|
|
675
|
-
const setHref = f.createExpressionStatement(
|
|
676
|
-
f.createBinaryExpression(
|
|
677
|
-
f.createPropertyAccessExpression(f.createIdentifier("link"), "href"),
|
|
678
|
-
ts.SyntaxKind.EqualsToken,
|
|
679
|
-
f.createIdentifier("href"),
|
|
680
|
-
),
|
|
681
|
-
);
|
|
682
|
-
|
|
683
|
-
// d.head.appendChild(link);
|
|
684
|
-
const append = f.createExpressionStatement(
|
|
685
|
-
f.createCallExpression(
|
|
686
|
-
f.createPropertyAccessExpression(
|
|
687
|
-
f.createPropertyAccessExpression(f.createIdentifier("d"), "head"),
|
|
688
|
-
"appendChild",
|
|
689
|
-
),
|
|
690
|
-
undefined,
|
|
691
|
-
[f.createIdentifier("link")],
|
|
692
|
-
),
|
|
693
|
-
);
|
|
694
|
-
|
|
695
|
-
const body = f.createBlock(
|
|
696
|
-
[declD, declLink, ifReturn, mkLink, setRel, setData, setHref, append],
|
|
697
|
-
true,
|
|
698
|
-
);
|
|
699
|
-
|
|
700
|
-
return f.createFunctionDeclaration(
|
|
701
|
-
undefined,
|
|
702
|
-
undefined,
|
|
703
|
-
f.createIdentifier("__sdEnsureStyle"),
|
|
704
|
-
undefined,
|
|
705
|
-
[hrefParam],
|
|
706
|
-
undefined,
|
|
707
|
-
body,
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
function makeEnsureCallInStatic(href: string) {
|
|
712
|
-
return f.createExpressionStatement(
|
|
713
|
-
f.createCallExpression(
|
|
714
|
-
f.createIdentifier("__sdEnsureStyle"),
|
|
715
|
-
undefined,
|
|
716
|
-
[f.createStringLiteral(href)], // 필요하면 devBust 인자도 추가 가능
|
|
717
|
-
),
|
|
718
|
-
);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
const upsertEnsureStyleHelper = (sf: ts.SourceFile): ts.SourceFile => {
|
|
722
|
-
// 이미 있으면 스킵
|
|
723
|
-
if (
|
|
724
|
-
sf.statements.some((s) => ts.isFunctionDeclaration(s) && s.name?.text === "__sdEnsureStyle")
|
|
725
|
-
) {
|
|
726
|
-
return sf;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
const fn = makeEnsureStyleFunc();
|
|
730
|
-
|
|
731
|
-
const href = path.basename(sf.fileName).replace(/\.ts$/, ".css");
|
|
732
|
-
const call = makeEnsureCallInStatic(href);
|
|
733
|
-
|
|
734
|
-
if (this._opt.isForBundle) {
|
|
735
|
-
return f.updateSourceFile(sf, [fn, call, ...sf.statements]);
|
|
736
|
-
} else {
|
|
737
|
-
const importTarget = "./" + path.basename(sf.fileName).replace(/\.ts$/, ".css");
|
|
738
|
-
const importDecl = f.createImportDeclaration(
|
|
739
|
-
undefined,
|
|
740
|
-
undefined,
|
|
741
|
-
f.createStringLiteral(importTarget),
|
|
742
|
-
);
|
|
743
|
-
|
|
744
|
-
return f.updateSourceFile(sf, [fn, call, importDecl, ...sf.statements]);
|
|
745
|
-
}
|
|
746
|
-
};*/
|
|
747
|
-
|
|
748
601
|
function upsertEnsureStyleHelper(sf: ts.SourceFile): ts.SourceFile {
|
|
749
|
-
|
|
602
|
+
const importTarget = "./" + path.basename(sf.fileName).replace(/\.ts$/, ".css");
|
|
603
|
+
|
|
604
|
+
// 이미 동일한 import가 있으면 스킵
|
|
750
605
|
if (
|
|
751
|
-
sf.statements.some(
|
|
606
|
+
sf.statements.some(
|
|
607
|
+
(s) =>
|
|
608
|
+
ts.isImportDeclaration(s) &&
|
|
609
|
+
ts.isStringLiteral(s.moduleSpecifier) &&
|
|
610
|
+
s.moduleSpecifier.text === importTarget,
|
|
611
|
+
)
|
|
752
612
|
) {
|
|
753
613
|
return sf;
|
|
754
614
|
}
|
|
755
615
|
|
|
756
|
-
const importTarget = "./" + path.basename(sf.fileName).replace(/\.ts$/, ".css");
|
|
757
616
|
const importDecl = f.createImportDeclaration(
|
|
758
|
-
undefined,
|
|
759
|
-
undefined,
|
|
617
|
+
undefined,
|
|
618
|
+
undefined,
|
|
760
619
|
f.createStringLiteral(importTarget),
|
|
761
620
|
);
|
|
762
621
|
|
|
@@ -834,7 +693,7 @@ export class SdTsCompiler {
|
|
|
834
693
|
return ts.visitNode(realSf, visitor) as ts.SourceFile;
|
|
835
694
|
};
|
|
836
695
|
};
|
|
837
|
-
}
|
|
696
|
+
}*/
|
|
838
697
|
|
|
839
698
|
#convertOutputToReal(filePath: string, distPath: string, text: string) {
|
|
840
699
|
let realFilePath = PathUtils.norm(filePath);
|