@l-comedy/core 0.1.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.
Files changed (31) hide show
  1. package/bin/lcomedy.js +1 -0
  2. package/dist/index.d.ts +85 -0
  3. package/dist/index.js +34 -0
  4. package/dist/plugins/app-config/createLComedyPluginAppConfig.d.ts +8 -0
  5. package/dist/plugins/app-config/createLComedyPluginAppConfig.js +161 -0
  6. package/dist/plugins/app-config/index.d.ts +5 -0
  7. package/dist/plugins/app-config/index.js +159 -0
  8. package/dist/plugins/html/createHtmlFile.d.ts +8 -0
  9. package/dist/plugins/html/createHtmlFile.js +61 -0
  10. package/dist/plugins/html/createLComedyPluginHtml.d.ts +8 -0
  11. package/dist/plugins/html/createLComedyPluginHtml.js +147 -0
  12. package/dist/plugins/html/createTemplateParameters.d.ts +12 -0
  13. package/dist/plugins/html/createTemplateParameters.js +39 -0
  14. package/dist/plugins/html/index.d.ts +5 -0
  15. package/dist/plugins/html/index.js +145 -0
  16. package/dist/plugins/layout/createLComedyPluginLayout.d.ts +8 -0
  17. package/dist/plugins/layout/createLComedyPluginLayout.js +69 -0
  18. package/dist/plugins/layout/index.d.ts +5 -0
  19. package/dist/plugins/layout/index.js +67 -0
  20. package/dist/plugins/page-loading/createLComedyPluginPageLoading.d.ts +8 -0
  21. package/dist/plugins/page-loading/createLComedyPluginPageLoading.js +67 -0
  22. package/dist/plugins/page-loading/index.d.ts +5 -0
  23. package/dist/plugins/page-loading/index.js +65 -0
  24. package/dist/plugins/route/createLComedyPluginRoute.d.ts +8 -0
  25. package/dist/plugins/route/createLComedyPluginRoute.js +118 -0
  26. package/dist/plugins/route/index.d.ts +5 -0
  27. package/dist/plugins/route/index.js +116 -0
  28. package/dist/plugins/types.d-gldCJl0t.d.ts +83 -0
  29. package/dist/run.d.ts +2 -0
  30. package/dist/run.js +634 -0
  31. package/package.json +66 -0
@@ -0,0 +1,12 @@
1
+ import { S as SetupConfigPlugin } from '../types.d-gldCJl0t.js';
2
+ import '@rspack/core';
3
+ import 'html-webpack-plugin';
4
+ import '@jest/types';
5
+
6
+ declare function createTemplateParameters(setupConfig: SetupConfigPlugin): {
7
+ BUILD_TIME: string;
8
+ TITLE: string;
9
+ ROOT_ID: string;
10
+ };
11
+
12
+ export { createTemplateParameters };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/plugins/html/createTemplateParameters.ts
21
+ var createTemplateParameters_exports = {};
22
+ __export(createTemplateParameters_exports, {
23
+ createTemplateParameters: () => createTemplateParameters
24
+ });
25
+ module.exports = __toCommonJS(createTemplateParameters_exports);
26
+ function createTemplateParameters(setupConfig) {
27
+ var _a, _b;
28
+ return {
29
+ BUILD_TIME: (/* @__PURE__ */ new Date()).toISOString(),
30
+ // BUILD_TIMESTAMP: Date.now(),
31
+ // IS_PROD: setupConfig.isProd,
32
+ TITLE: ((_a = setupConfig.userConfig.html) == null ? void 0 : _a.title) || "App",
33
+ ROOT_ID: ((_b = setupConfig.userConfig.html) == null ? void 0 : _b.rootId) || "root"
34
+ };
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ createTemplateParameters
39
+ });
@@ -0,0 +1,5 @@
1
+ export { createLComedyPluginHtml as default } from './createLComedyPluginHtml.js';
2
+ import '../types.d-gldCJl0t.js';
3
+ import '@rspack/core';
4
+ import 'html-webpack-plugin';
5
+ import '@jest/types';
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __async = (__this, __arguments, generator) => {
47
+ return new Promise((resolve, reject) => {
48
+ var fulfilled = (value) => {
49
+ try {
50
+ step(generator.next(value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ };
55
+ var rejected = (value) => {
56
+ try {
57
+ step(generator.throw(value));
58
+ } catch (e) {
59
+ reject(e);
60
+ }
61
+ };
62
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
+ step((generator = generator.apply(__this, __arguments)).next());
64
+ });
65
+ };
66
+
67
+ // src/plugins/html/index.ts
68
+ var html_exports = {};
69
+ __export(html_exports, {
70
+ default: () => createLComedyPluginHtml
71
+ });
72
+ module.exports = __toCommonJS(html_exports);
73
+
74
+ // src/plugins/html/createLComedyPluginHtml.ts
75
+ var import_path2 = __toESM(require("path"));
76
+ var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"));
77
+
78
+ // src/plugins/html/createHtmlFile.ts
79
+ var import_fs_extra = __toESM(require("fs-extra"));
80
+ var import_path = __toESM(require("path"));
81
+ function createHtmlFile(setupConfig) {
82
+ var _a, _b, _c;
83
+ const htmlConfig = setupConfig.userConfig.html || {};
84
+ import_fs_extra.default.outputFileSync(
85
+ import_path.default.posix.join(setupConfig.workDir, "index.html"),
86
+ `<!DOCTYPE html>
87
+ <html>
88
+ <head>
89
+ <meta charset="utf-8" />
90
+ <title><%= TITLE %></title>
91
+ ${((_a = htmlConfig.headTags) == null ? void 0 : _a.join("\n")) || ""}
92
+ </head>
93
+ <body>
94
+ ${((_b = htmlConfig.bodyBeforeTags) == null ? void 0 : _b.join("\n")) || ""}
95
+ <div id="<%= ROOT_ID %>"></div>
96
+ ${((_c = htmlConfig.bodyAfterTags) == null ? void 0 : _c.join("\n")) || ""}
97
+ </body>
98
+ </html>`
99
+ );
100
+ }
101
+
102
+ // src/plugins/html/createTemplateParameters.ts
103
+ function createTemplateParameters(setupConfig) {
104
+ var _a, _b;
105
+ return {
106
+ BUILD_TIME: (/* @__PURE__ */ new Date()).toISOString(),
107
+ // BUILD_TIMESTAMP: Date.now(),
108
+ // IS_PROD: setupConfig.isProd,
109
+ TITLE: ((_a = setupConfig.userConfig.html) == null ? void 0 : _a.title) || "App",
110
+ ROOT_ID: ((_b = setupConfig.userConfig.html) == null ? void 0 : _b.rootId) || "root"
111
+ };
112
+ }
113
+
114
+ // src/plugins/html/createLComedyPluginHtml.ts
115
+ function createLComedyPluginHtml() {
116
+ return {
117
+ name: "l-comedy-plugin-html",
118
+ rspackConfig(rspackConfig, setupConfig) {
119
+ var _a2, _b;
120
+ return __spreadProps(__spreadValues({}, rspackConfig), {
121
+ plugins: [
122
+ ...rspackConfig.plugins || [],
123
+ new import_html_webpack_plugin.default(__spreadProps(__spreadValues({
124
+ template: import_path2.default.posix.join(setupConfig.workDir, "index.html"),
125
+ filename: "index.html",
126
+ minify: setupConfig.isProd ? {
127
+ collapseWhitespace: true,
128
+ removeComments: true,
129
+ removeRedundantAttributes: true
130
+ } : false,
131
+ cache: true,
132
+ inject: true
133
+ }, (_a2 = setupConfig.userConfig.html) == null ? void 0 : _a2.htmlWebpackOptions), {
134
+ templateParameters: __spreadValues(__spreadValues({}, (_b = setupConfig.userConfig.html) == null ? void 0 : _b.htmlTemplateParametersData), createTemplateParameters(setupConfig))
135
+ }))
136
+ ]
137
+ });
138
+ },
139
+ generateFiles(setupConfig) {
140
+ return __async(this, null, function* () {
141
+ createHtmlFile(setupConfig);
142
+ });
143
+ }
144
+ };
145
+ }
@@ -0,0 +1,8 @@
1
+ import { L as LComedyPlugin } from '../types.d-gldCJl0t.js';
2
+ import '@rspack/core';
3
+ import 'html-webpack-plugin';
4
+ import '@jest/types';
5
+
6
+ declare function createLComedyPluginLayout(): LComedyPlugin;
7
+
8
+ export { createLComedyPluginLayout };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/plugins/layout/createLComedyPluginLayout.ts
31
+ var createLComedyPluginLayout_exports = {};
32
+ __export(createLComedyPluginLayout_exports, {
33
+ createLComedyPluginLayout: () => createLComedyPluginLayout
34
+ });
35
+ module.exports = __toCommonJS(createLComedyPluginLayout_exports);
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_path = __toESM(require("path"));
38
+ function createLComedyPluginLayout() {
39
+ return {
40
+ name: "l-comedy-plugin-layout",
41
+ modifyEntry(setupConfig) {
42
+ let hasLayout = false;
43
+ const imports = [];
44
+ const layoutPath = import_path.default.posix.join(
45
+ setupConfig.sourceDir,
46
+ "layout/index.tsx"
47
+ );
48
+ if (import_fs_extra.default.existsSync(layoutPath)) {
49
+ hasLayout = true;
50
+ imports.push("import Layout from '@/layout/index'");
51
+ }
52
+ return {
53
+ imports,
54
+ appWrap(app) {
55
+ if (!hasLayout) {
56
+ return app;
57
+ }
58
+ return `<Layout>
59
+ ${app}
60
+ </Layout>`;
61
+ }
62
+ };
63
+ }
64
+ };
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ createLComedyPluginLayout
69
+ });
@@ -0,0 +1,5 @@
1
+ export { createLComedyPluginLayout as default } from './createLComedyPluginLayout.js';
2
+ import '../types.d-gldCJl0t.js';
3
+ import '@rspack/core';
4
+ import 'html-webpack-plugin';
5
+ import '@jest/types';
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/plugins/layout/index.ts
31
+ var layout_exports = {};
32
+ __export(layout_exports, {
33
+ default: () => createLComedyPluginLayout
34
+ });
35
+ module.exports = __toCommonJS(layout_exports);
36
+
37
+ // src/plugins/layout/createLComedyPluginLayout.ts
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ var import_path = __toESM(require("path"));
40
+ function createLComedyPluginLayout() {
41
+ return {
42
+ name: "l-comedy-plugin-layout",
43
+ modifyEntry(setupConfig) {
44
+ let hasLayout = false;
45
+ const imports = [];
46
+ const layoutPath = import_path.default.posix.join(
47
+ setupConfig.sourceDir,
48
+ "layout/index.tsx"
49
+ );
50
+ if (import_fs_extra.default.existsSync(layoutPath)) {
51
+ hasLayout = true;
52
+ imports.push("import Layout from '@/layout/index'");
53
+ }
54
+ return {
55
+ imports,
56
+ appWrap(app) {
57
+ if (!hasLayout) {
58
+ return app;
59
+ }
60
+ return `<Layout>
61
+ ${app}
62
+ </Layout>`;
63
+ }
64
+ };
65
+ }
66
+ };
67
+ }
@@ -0,0 +1,8 @@
1
+ import { L as LComedyPlugin } from '../types.d-gldCJl0t.js';
2
+ import '@rspack/core';
3
+ import 'html-webpack-plugin';
4
+ import '@jest/types';
5
+
6
+ declare function createLComedyPluginPageLoading(): LComedyPlugin;
7
+
8
+ export { createLComedyPluginPageLoading };
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/plugins/page-loading/createLComedyPluginPageLoading.ts
31
+ var createLComedyPluginPageLoading_exports = {};
32
+ __export(createLComedyPluginPageLoading_exports, {
33
+ createLComedyPluginPageLoading: () => createLComedyPluginPageLoading
34
+ });
35
+ module.exports = __toCommonJS(createLComedyPluginPageLoading_exports);
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_path = __toESM(require("path"));
38
+ function createLComedyPluginPageLoading() {
39
+ return {
40
+ name: "l-comedy-plugin-page-loading",
41
+ modifyEntry(setupConfig) {
42
+ let hasLoading = false;
43
+ const imports = [];
44
+ const pageLoadingPath = import_path.default.posix.join(
45
+ setupConfig.sourceDir,
46
+ "layout/PageLoading.tsx"
47
+ );
48
+ if (import_fs_extra.default.existsSync(pageLoadingPath)) {
49
+ hasLoading = true;
50
+ imports.push("import PageLoading from '@/layout/PageLoading'");
51
+ }
52
+ return {
53
+ imports,
54
+ reactImports: ["Suspense"],
55
+ appWrap(app) {
56
+ return `<Suspense fallback={${hasLoading ? "<PageLoading />" : "<div />"}}>
57
+ ${app}
58
+ </Suspense>`;
59
+ }
60
+ };
61
+ }
62
+ };
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ createLComedyPluginPageLoading
67
+ });
@@ -0,0 +1,5 @@
1
+ export { createLComedyPluginPageLoading as default } from './createLComedyPluginPageLoading.js';
2
+ import '../types.d-gldCJl0t.js';
3
+ import '@rspack/core';
4
+ import 'html-webpack-plugin';
5
+ import '@jest/types';
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/plugins/page-loading/index.ts
31
+ var page_loading_exports = {};
32
+ __export(page_loading_exports, {
33
+ default: () => createLComedyPluginPageLoading
34
+ });
35
+ module.exports = __toCommonJS(page_loading_exports);
36
+
37
+ // src/plugins/page-loading/createLComedyPluginPageLoading.ts
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ var import_path = __toESM(require("path"));
40
+ function createLComedyPluginPageLoading() {
41
+ return {
42
+ name: "l-comedy-plugin-page-loading",
43
+ modifyEntry(setupConfig) {
44
+ let hasLoading = false;
45
+ const imports = [];
46
+ const pageLoadingPath = import_path.default.posix.join(
47
+ setupConfig.sourceDir,
48
+ "layout/PageLoading.tsx"
49
+ );
50
+ if (import_fs_extra.default.existsSync(pageLoadingPath)) {
51
+ hasLoading = true;
52
+ imports.push("import PageLoading from '@/layout/PageLoading'");
53
+ }
54
+ return {
55
+ imports,
56
+ reactImports: ["Suspense"],
57
+ appWrap(app) {
58
+ return `<Suspense fallback={${hasLoading ? "<PageLoading />" : "<div />"}}>
59
+ ${app}
60
+ </Suspense>`;
61
+ }
62
+ };
63
+ }
64
+ };
65
+ }
@@ -0,0 +1,8 @@
1
+ import { L as LComedyPlugin } from '../types.d-gldCJl0t.js';
2
+ import '@rspack/core';
3
+ import 'html-webpack-plugin';
4
+ import '@jest/types';
5
+
6
+ declare function createLComedyPluginRoute(): LComedyPlugin;
7
+
8
+ export { createLComedyPluginRoute };
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
49
+
50
+ // src/plugins/route/createLComedyPluginRoute.ts
51
+ var createLComedyPluginRoute_exports = {};
52
+ __export(createLComedyPluginRoute_exports, {
53
+ createLComedyPluginRoute: () => createLComedyPluginRoute
54
+ });
55
+ module.exports = __toCommonJS(createLComedyPluginRoute_exports);
56
+ var import_fs_extra = __toESM(require("fs-extra"));
57
+ var import_path = __toESM(require("path"));
58
+ function createLComedyPluginRoute() {
59
+ let componentIndex = 0;
60
+ return {
61
+ name: "l-comedy-plugin-route",
62
+ generateFiles(setupConfig) {
63
+ return __async(this, null, function* () {
64
+ var _a2;
65
+ componentIndex = 0;
66
+ const routes = ((_a2 = setupConfig.userConfig.route) == null ? void 0 : _a2.routes) || [];
67
+ const importsCode = [];
68
+ const computeRoutesCode = (routes2) => {
69
+ return ` ${routes2.map((route) => {
70
+ ++componentIndex;
71
+ importsCode.push(
72
+ route.lazy ? `const Component${componentIndex} = lazy(() => import('${route.component}'))` : `import Component${componentIndex} from '${route.component}'`
73
+ );
74
+ return `<Route path="${route.path}" element={<Component${componentIndex} />}${route.index ? " index" : ""}${route.children ? `>
75
+ ${computeRoutesCode(route.children)}
76
+ </Route>` : " />"}`;
77
+ }).join("\n")}`;
78
+ };
79
+ let routesCode = `<Routes>
80
+ ${computeRoutesCode(routes)}
81
+ </Routes>`;
82
+ import_fs_extra.default.outputFileSync(
83
+ import_path.default.posix.join(setupConfig.workDir, "runtimes", "route/AppRoutes.tsx"),
84
+ `import { lazy } from 'react'
85
+ import { Routes, Route } from 'react-router'
86
+ ${importsCode.join("\n")}
87
+
88
+ export default function AppRoutes() {
89
+ return (
90
+ ${routesCode}
91
+ )
92
+ }`
93
+ );
94
+ });
95
+ },
96
+ modifyEntry(setupConfig) {
97
+ return {
98
+ imports: [
99
+ "import { BrowserRouter } from 'react-router'",
100
+ "import AppRoutes from './runtimes/route/AppRoutes'"
101
+ ],
102
+ appWrap(app) {
103
+ var _a2;
104
+ return `<BrowserRouter${((_a2 = setupConfig.userConfig.route) == null ? void 0 : _a2.basename) ? ` basename="${setupConfig.userConfig.route.basename}"` : ""}>
105
+ ${app}
106
+ </BrowserRouter>`;
107
+ },
108
+ app() {
109
+ return "<AppRoutes />";
110
+ }
111
+ };
112
+ }
113
+ };
114
+ }
115
+ // Annotate the CommonJS export names for ESM import in node:
116
+ 0 && (module.exports = {
117
+ createLComedyPluginRoute
118
+ });
@@ -0,0 +1,5 @@
1
+ export { createLComedyPluginRoute as default } from './createLComedyPluginRoute.js';
2
+ import '../types.d-gldCJl0t.js';
3
+ import '@rspack/core';
4
+ import 'html-webpack-plugin';
5
+ import '@jest/types';