@l-comedy/core 0.1.0 → 0.1.1
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.d.ts +14 -0
- package/dist/plugins/app-config/createLComedyPluginAppConfig.d.ts +2 -1
- package/dist/plugins/app-config/index.d.ts +2 -1
- package/dist/plugins/html/createHtmlFile.d.ts +2 -1
- package/dist/plugins/html/createLComedyPluginHtml.d.ts +2 -1
- package/dist/plugins/html/createTemplateParameters.d.ts +2 -1
- package/dist/plugins/html/index.d.ts +2 -1
- package/dist/plugins/layout/createLComedyPluginLayout.d.ts +2 -1
- package/dist/plugins/layout/index.d.ts +2 -1
- package/dist/plugins/page-loading/createLComedyPluginPageLoading.d.ts +2 -1
- package/dist/plugins/page-loading/index.d.ts +2 -1
- package/dist/plugins/route/createLComedyPluginRoute.d.ts +2 -1
- package/dist/plugins/route/index.d.ts +2 -1
- package/dist/plugins/{types.d-gldCJl0t.d.ts → types.d-LN_39F7o.d.ts} +14 -0
- package/dist/run.js +63 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Configuration } from '@rspack/core';
|
|
2
|
+
import { Options as Options$1 } from 'tsup';
|
|
2
3
|
import { Options } from 'html-webpack-plugin';
|
|
3
4
|
import { Config } from '@jest/types';
|
|
4
5
|
|
|
@@ -21,6 +22,7 @@ interface UserConfig {
|
|
|
21
22
|
output?: string
|
|
22
23
|
publicDir?: string
|
|
23
24
|
test?: TestConfig
|
|
25
|
+
tsup?: TsupConfig
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
interface LComedyPlugin {
|
|
@@ -50,6 +52,7 @@ interface HtmlConfig {
|
|
|
50
52
|
headTags?: string[]
|
|
51
53
|
bodyBeforeTags?: string[]
|
|
52
54
|
bodyAfterTags?: string[]
|
|
55
|
+
metaViewport?: string
|
|
53
56
|
htmlWebpackOptions?: Options
|
|
54
57
|
htmlTemplateParametersData?: Record<string, any>
|
|
55
58
|
}
|
|
@@ -78,6 +81,17 @@ interface EntryModifier {
|
|
|
78
81
|
appWrap?: (app: string) => string
|
|
79
82
|
render?: (render: string) => string
|
|
80
83
|
renderRun?: (renderRun: string) => string
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface TsupConfig {
|
|
87
|
+
targets: TsupConfigTarget[]
|
|
88
|
+
outDir?: string
|
|
89
|
+
options?: Partial<Omit<Options$1, 'entry' | 'outDir'>>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface TsupConfigTarget {
|
|
93
|
+
entry: string
|
|
94
|
+
relativeOutDir?: string
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
declare function defineConfig(config: UserConfig): UserConfig;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Configuration } from '@rspack/core';
|
|
2
|
+
import { Options as Options$1 } from 'tsup';
|
|
2
3
|
import { Options } from 'html-webpack-plugin';
|
|
3
4
|
import { Config } from '@jest/types';
|
|
4
5
|
|
|
@@ -21,6 +22,7 @@ interface UserConfig {
|
|
|
21
22
|
output?: string
|
|
22
23
|
publicDir?: string
|
|
23
24
|
test?: TestConfig
|
|
25
|
+
tsup?: TsupConfig
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
interface LComedyPlugin {
|
|
@@ -50,6 +52,7 @@ interface HtmlConfig {
|
|
|
50
52
|
headTags?: string[]
|
|
51
53
|
bodyBeforeTags?: string[]
|
|
52
54
|
bodyAfterTags?: string[]
|
|
55
|
+
metaViewport?: string
|
|
53
56
|
htmlWebpackOptions?: Options
|
|
54
57
|
htmlTemplateParametersData?: Record<string, any>
|
|
55
58
|
}
|
|
@@ -78,6 +81,17 @@ interface EntryModifier {
|
|
|
78
81
|
appWrap?: (app: string) => string
|
|
79
82
|
render?: (render: string) => string
|
|
80
83
|
renderRun?: (renderRun: string) => string
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface TsupConfig {
|
|
87
|
+
targets: TsupConfigTarget[]
|
|
88
|
+
outDir?: string
|
|
89
|
+
options?: Partial<Omit<Options$1, 'entry' | 'outDir'>>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface TsupConfigTarget {
|
|
93
|
+
entry: string
|
|
94
|
+
relativeOutDir?: string
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
export type { LComedyPlugin as L, SetupConfigPlugin as S };
|
package/dist/run.js
CHANGED
|
@@ -626,9 +626,72 @@ function test(options) {
|
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
+
// src/commands/tsup.ts
|
|
630
|
+
var import_path11 = __toESM(require("path"));
|
|
631
|
+
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
632
|
+
var import_tsup = require("tsup");
|
|
633
|
+
function runTsup(options) {
|
|
634
|
+
return __async(this, null, function* () {
|
|
635
|
+
var _a;
|
|
636
|
+
const root = process.cwd().replace(/\\/g, "/");
|
|
637
|
+
const filePath = import_path11.default.posix.join(
|
|
638
|
+
root,
|
|
639
|
+
(options == null ? void 0 : options.config) ? options.config : getDefaultUserConfigName()
|
|
640
|
+
);
|
|
641
|
+
const userConfig = loadUserConfig(filePath);
|
|
642
|
+
if (!((_a = userConfig.tsup) == null ? void 0 : _a.targets.length)) {
|
|
643
|
+
console.error("\u6CA1\u6709tsup\u914D\u7F6E");
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
const outDir = userConfig.tsup.outDir || "libs";
|
|
647
|
+
const outPath = import_path11.default.posix.join(root, outDir);
|
|
648
|
+
import_fs_extra7.default.ensureDirSync(outPath);
|
|
649
|
+
import_fs_extra7.default.emptyDirSync(outPath);
|
|
650
|
+
for (const target of userConfig.tsup.targets) {
|
|
651
|
+
yield (0, import_tsup.build)(__spreadValues({
|
|
652
|
+
entry: [
|
|
653
|
+
target.entry,
|
|
654
|
+
`${target.entry}.{ts,tsx}`,
|
|
655
|
+
"!**/*.d.ts",
|
|
656
|
+
"!**/__tests__",
|
|
657
|
+
"!**/*.test.*"
|
|
658
|
+
],
|
|
659
|
+
outDir: import_path11.default.posix.join(root, outDir, "cjs", target.relativeOutDir || ""),
|
|
660
|
+
format: ["cjs"],
|
|
661
|
+
dts: true,
|
|
662
|
+
sourcemap: false,
|
|
663
|
+
clean: false,
|
|
664
|
+
minify: false,
|
|
665
|
+
bundle: false,
|
|
666
|
+
outExtension: () => ({ js: ".js", dts: ".d.ts" })
|
|
667
|
+
}, userConfig.tsup.options));
|
|
668
|
+
}
|
|
669
|
+
for (const target of userConfig.tsup.targets) {
|
|
670
|
+
yield (0, import_tsup.build)(__spreadValues({
|
|
671
|
+
entry: [
|
|
672
|
+
target.entry,
|
|
673
|
+
`${target.entry}.{ts,tsx}`,
|
|
674
|
+
"!**/*.d.ts",
|
|
675
|
+
"!**/__tests__",
|
|
676
|
+
"!**/*.test.*"
|
|
677
|
+
],
|
|
678
|
+
outDir: import_path11.default.posix.join(root, outDir, "esm", target.relativeOutDir || ""),
|
|
679
|
+
format: ["esm"],
|
|
680
|
+
dts: true,
|
|
681
|
+
sourcemap: false,
|
|
682
|
+
clean: false,
|
|
683
|
+
minify: false,
|
|
684
|
+
bundle: false,
|
|
685
|
+
outExtension: () => ({ js: ".js", dts: ".d.ts" })
|
|
686
|
+
}, userConfig.tsup.options));
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
|
|
629
691
|
// src/run.ts
|
|
630
692
|
var program = new import_commander.Command();
|
|
631
693
|
program.command("dev").description("Start development server").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").action(dev);
|
|
632
694
|
program.command("build").description("Build app").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").action(build);
|
|
633
695
|
program.command("test").description("Run test").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").option("-t, --type <type>", "\u6307\u5B9A\u6D4B\u8BD5\u7C7B\u578B\uFF08unit/components/all\uFF09", "all").action(test);
|
|
696
|
+
program.command("tsup").description("Run tsup build").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").action(runTsup);
|
|
634
697
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@l-comedy/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "pnpm install && pnpm build-index && pnpm build-run && pnpm build-plugins",
|
|
32
32
|
"build-index": "tsup src/index.ts --format cjs --dts --clean",
|
|
33
|
-
"build-run": "tsup src/run.ts --format cjs --dts",
|
|
33
|
+
"build-run": "tsup src/run.ts --format cjs --dts --external tsup",
|
|
34
34
|
"build-plugins": "tsup src/plugins --format cjs --dts --outDir dist/plugins"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@rspack/cli": "^1.6.6",
|
|
38
37
|
"@rspack/core": "^1.6.6",
|
|
39
38
|
"@rspack/dev-server": "^1.1.4",
|
|
40
39
|
"chokidar": "^5.0.0",
|
|
@@ -55,7 +54,8 @@
|
|
|
55
54
|
},
|
|
56
55
|
"optionalDependencies": {
|
|
57
56
|
"@l-comedy/jest-preset": "^0.1.0",
|
|
58
|
-
"react-router": "^7.0.0"
|
|
57
|
+
"react-router": "^7.0.0",
|
|
58
|
+
"tsup": "^8.5.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@jest/types": "29.6.3",
|