@l-comedy/core 0.1.0 → 0.1.2
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 +67 -0
- package/package.json +6 -8
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,76 @@ 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 || "lib";
|
|
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
|
+
target: "node16",
|
|
667
|
+
platform: "node",
|
|
668
|
+
outExtension: () => ({ js: ".js", dts: ".d.ts" })
|
|
669
|
+
}, userConfig.tsup.options));
|
|
670
|
+
}
|
|
671
|
+
for (const target of userConfig.tsup.targets) {
|
|
672
|
+
yield (0, import_tsup.build)(__spreadValues({
|
|
673
|
+
entry: [
|
|
674
|
+
target.entry,
|
|
675
|
+
`${target.entry}.{ts,tsx}`,
|
|
676
|
+
"!**/*.d.ts",
|
|
677
|
+
"!**/__tests__",
|
|
678
|
+
"!**/*.test.*"
|
|
679
|
+
],
|
|
680
|
+
outDir: import_path11.default.posix.join(root, outDir, "esm", target.relativeOutDir || ""),
|
|
681
|
+
format: ["esm"],
|
|
682
|
+
dts: true,
|
|
683
|
+
sourcemap: false,
|
|
684
|
+
clean: false,
|
|
685
|
+
minify: false,
|
|
686
|
+
bundle: false,
|
|
687
|
+
target: "node16",
|
|
688
|
+
platform: "node",
|
|
689
|
+
outExtension: () => ({ js: ".js", dts: ".d.ts" })
|
|
690
|
+
}, userConfig.tsup.options));
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
|
|
629
695
|
// src/run.ts
|
|
630
696
|
var program = new import_commander.Command();
|
|
631
697
|
program.command("dev").description("Start development server").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").action(dev);
|
|
632
698
|
program.command("build").description("Build app").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").action(build);
|
|
633
699
|
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);
|
|
700
|
+
program.command("tsup").description("Run tsup build").option("-c, --config <path>", "\u6307\u5B9A\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84").action(runTsup);
|
|
634
701
|
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.2",
|
|
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",
|
|
@@ -49,13 +48,12 @@
|
|
|
49
48
|
"style-loader": "4.0.0",
|
|
50
49
|
"ts-loader": "^9.5.4"
|
|
51
50
|
},
|
|
52
|
-
"peerDependencies": {
|
|
53
|
-
"react": "^18.0.0 || ^19.0.0",
|
|
54
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
55
|
-
},
|
|
56
51
|
"optionalDependencies": {
|
|
57
52
|
"@l-comedy/jest-preset": "^0.1.0",
|
|
58
|
-
"react
|
|
53
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
54
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
55
|
+
"react-router": "^7.0.0",
|
|
56
|
+
"tsup": "^8.5.1"
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
59
|
"@jest/types": "29.6.3",
|