@l-comedy/core 0.1.2 → 0.1.3
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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { L as LComedyPlugin } from '../types.d-LN_39F7o.js';
|
|
2
|
+
import '@rspack/core';
|
|
3
|
+
import 'tsup';
|
|
4
|
+
import 'html-webpack-plugin';
|
|
5
|
+
import '@jest/types';
|
|
6
|
+
|
|
7
|
+
declare function createLComedyPluginGlobalCSS(): LComedyPlugin;
|
|
8
|
+
|
|
9
|
+
export { createLComedyPluginGlobalCSS };
|
|
@@ -0,0 +1,59 @@
|
|
|
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/global-css/createLComedyPluginGlobalCSS.ts
|
|
31
|
+
var createLComedyPluginGlobalCSS_exports = {};
|
|
32
|
+
__export(createLComedyPluginGlobalCSS_exports, {
|
|
33
|
+
createLComedyPluginGlobalCSS: () => createLComedyPluginGlobalCSS
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(createLComedyPluginGlobalCSS_exports);
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var names = ["global.css", "global.less"];
|
|
39
|
+
function createLComedyPluginGlobalCSS() {
|
|
40
|
+
return {
|
|
41
|
+
name: "l-comedy-plugin-global-css",
|
|
42
|
+
modifyEntry(setupConfig) {
|
|
43
|
+
const imports = [];
|
|
44
|
+
names.forEach((name) => {
|
|
45
|
+
const cssPath = import_path.default.posix.join(setupConfig.sourceDir, name);
|
|
46
|
+
if (import_fs_extra.default.existsSync(cssPath)) {
|
|
47
|
+
imports.push(`import '@/${name}'`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
imports
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
createLComedyPluginGlobalCSS
|
|
59
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
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/global-css/index.ts
|
|
31
|
+
var global_css_exports = {};
|
|
32
|
+
__export(global_css_exports, {
|
|
33
|
+
default: () => createLComedyPluginGlobalCSS
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(global_css_exports);
|
|
36
|
+
|
|
37
|
+
// src/plugins/global-css/createLComedyPluginGlobalCSS.ts
|
|
38
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
var names = ["global.css", "global.less"];
|
|
41
|
+
function createLComedyPluginGlobalCSS() {
|
|
42
|
+
return {
|
|
43
|
+
name: "l-comedy-plugin-global-css",
|
|
44
|
+
modifyEntry(setupConfig) {
|
|
45
|
+
const imports = [];
|
|
46
|
+
names.forEach((name) => {
|
|
47
|
+
const cssPath = import_path.default.posix.join(setupConfig.sourceDir, name);
|
|
48
|
+
if (import_fs_extra.default.existsSync(cssPath)) {
|
|
49
|
+
imports.push(`import '@/${name}'`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
imports
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
package/dist/run.js
CHANGED
|
@@ -63,14 +63,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
63
63
|
var import_commander = require("commander");
|
|
64
64
|
|
|
65
65
|
// src/commands/dev.ts
|
|
66
|
-
var
|
|
66
|
+
var import_path9 = __toESM(require("path"));
|
|
67
67
|
var import_core2 = require("@rspack/core");
|
|
68
68
|
var import_dev_server = require("@rspack/dev-server");
|
|
69
69
|
var import_chokidar = __toESM(require("chokidar"));
|
|
70
70
|
|
|
71
71
|
// src/setup.ts
|
|
72
|
-
var
|
|
73
|
-
var
|
|
72
|
+
var import_fs_extra6 = __toESM(require("fs-extra"));
|
|
73
|
+
var import_path8 = __toESM(require("path"));
|
|
74
74
|
|
|
75
75
|
// src/utils/setup/generateEntryFile.ts
|
|
76
76
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
@@ -376,6 +376,28 @@ function createLComedyPluginLayout() {
|
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
// src/plugins/global-css/createLComedyPluginGlobalCSS.ts
|
|
380
|
+
var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
381
|
+
var import_path7 = __toESM(require("path"));
|
|
382
|
+
var names = ["global.css", "global.less"];
|
|
383
|
+
function createLComedyPluginGlobalCSS() {
|
|
384
|
+
return {
|
|
385
|
+
name: "l-comedy-plugin-global-css",
|
|
386
|
+
modifyEntry(setupConfig) {
|
|
387
|
+
const imports = [];
|
|
388
|
+
names.forEach((name) => {
|
|
389
|
+
const cssPath = import_path7.default.posix.join(setupConfig.sourceDir, name);
|
|
390
|
+
if (import_fs_extra5.default.existsSync(cssPath)) {
|
|
391
|
+
imports.push(`import '@/${name}'`);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
return {
|
|
395
|
+
imports
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
379
401
|
// src/setup.ts
|
|
380
402
|
function setup(userConfig, options) {
|
|
381
403
|
return __async(this, null, function* () {
|
|
@@ -386,28 +408,29 @@ function setup(userConfig, options) {
|
|
|
386
408
|
isProd,
|
|
387
409
|
root: options.root,
|
|
388
410
|
workDir,
|
|
389
|
-
workPath:
|
|
411
|
+
workPath: import_path8.default.posix.join(options.root, workDir),
|
|
390
412
|
sourceDir,
|
|
391
|
-
sourcePath:
|
|
413
|
+
sourcePath: import_path8.default.posix.join(options.root, sourceDir),
|
|
392
414
|
userConfig
|
|
393
415
|
};
|
|
394
416
|
const plugins = [
|
|
395
417
|
createLComedyPluginAppConfig(),
|
|
396
418
|
createLComedyPluginHtml(),
|
|
397
419
|
createLComedyPluginLayout(),
|
|
398
|
-
createLComedyPluginPageLoading()
|
|
420
|
+
createLComedyPluginPageLoading(),
|
|
421
|
+
createLComedyPluginGlobalCSS()
|
|
399
422
|
];
|
|
400
423
|
for (const plugin of userConfig.plugins || []) {
|
|
401
424
|
if (typeof plugin === "string") {
|
|
402
425
|
plugins.push(
|
|
403
|
-
require(
|
|
426
|
+
require(import_path8.default.posix.join(__dirname, `./plugins/${plugin}`)).default()
|
|
404
427
|
);
|
|
405
428
|
} else if (typeof plugin === "object") {
|
|
406
429
|
plugins.push(plugin);
|
|
407
430
|
}
|
|
408
431
|
}
|
|
409
|
-
|
|
410
|
-
|
|
432
|
+
import_fs_extra6.default.ensureDirSync(baseConfig.workPath);
|
|
433
|
+
import_fs_extra6.default.emptyDirSync(baseConfig.workPath);
|
|
411
434
|
const modifiers = [];
|
|
412
435
|
for (const plugin of plugins) {
|
|
413
436
|
if (plugin.generateFiles) {
|
|
@@ -423,7 +446,7 @@ function setup(userConfig, options) {
|
|
|
423
446
|
});
|
|
424
447
|
yield generateEntryFile(
|
|
425
448
|
modifiers,
|
|
426
|
-
|
|
449
|
+
import_path8.default.posix.join(baseConfig.root, baseConfig.workDir),
|
|
427
450
|
setupConfig
|
|
428
451
|
);
|
|
429
452
|
let rspackConfig = {
|
|
@@ -445,7 +468,7 @@ function setup(userConfig, options) {
|
|
|
445
468
|
}
|
|
446
469
|
|
|
447
470
|
// src/utils/config/loadUserConfig.ts
|
|
448
|
-
var
|
|
471
|
+
var import_fs_extra7 = __toESM(require("fs-extra"));
|
|
449
472
|
var import_vm = __toESM(require("vm"));
|
|
450
473
|
var import_module = __toESM(require("module"));
|
|
451
474
|
var import_esbuild = require("esbuild");
|
|
@@ -460,7 +483,7 @@ ${e}`);
|
|
|
460
483
|
}
|
|
461
484
|
function runFileConfig(filepath) {
|
|
462
485
|
try {
|
|
463
|
-
const fileContent =
|
|
486
|
+
const fileContent = import_fs_extra7.default.readFileSync(filepath, "utf-8");
|
|
464
487
|
const result = (0, import_esbuild.transformSync)(fileContent, {
|
|
465
488
|
loader: "tsx",
|
|
466
489
|
format: "cjs"
|
|
@@ -492,7 +515,7 @@ function getDefaultUserConfigName() {
|
|
|
492
515
|
function dev(options) {
|
|
493
516
|
return __async(this, null, function* () {
|
|
494
517
|
const root = process.cwd().replace(/\\/g, "/");
|
|
495
|
-
const filePath =
|
|
518
|
+
const filePath = import_path9.default.posix.join(
|
|
496
519
|
root,
|
|
497
520
|
(options == null ? void 0 : options.config) ? options.config : getDefaultUserConfigName()
|
|
498
521
|
);
|
|
@@ -524,12 +547,12 @@ function createDevServer(root, filePath) {
|
|
|
524
547
|
}
|
|
525
548
|
|
|
526
549
|
// src/commands/build.ts
|
|
527
|
-
var
|
|
550
|
+
var import_path10 = __toESM(require("path"));
|
|
528
551
|
var import_core3 = require("@rspack/core");
|
|
529
552
|
function build(options) {
|
|
530
553
|
return __async(this, null, function* () {
|
|
531
554
|
const root = process.cwd().replace(/\\/g, "/");
|
|
532
|
-
const filePath =
|
|
555
|
+
const filePath = import_path10.default.posix.join(
|
|
533
556
|
root,
|
|
534
557
|
(options == null ? void 0 : options.config) ? options.config : getDefaultUserConfigName()
|
|
535
558
|
);
|
|
@@ -576,7 +599,7 @@ function runBuild(rspackConfig) {
|
|
|
576
599
|
}
|
|
577
600
|
|
|
578
601
|
// src/commands/test.ts
|
|
579
|
-
var
|
|
602
|
+
var import_path11 = __toESM(require("path"));
|
|
580
603
|
|
|
581
604
|
// src/utils/setup/loadOptionalDependency.ts
|
|
582
605
|
function loadOptionalDependency(packageName, importName) {
|
|
@@ -604,7 +627,7 @@ function test(options) {
|
|
|
604
627
|
if (jestPreset) {
|
|
605
628
|
const type = (options == null ? void 0 : options.type) || "all";
|
|
606
629
|
const root = process.cwd().replace(/\\/g, "/");
|
|
607
|
-
const filePath =
|
|
630
|
+
const filePath = import_path11.default.posix.join(
|
|
608
631
|
root,
|
|
609
632
|
(options == null ? void 0 : options.config) ? options.config : getDefaultUserConfigName()
|
|
610
633
|
);
|
|
@@ -627,14 +650,14 @@ function test(options) {
|
|
|
627
650
|
}
|
|
628
651
|
|
|
629
652
|
// src/commands/tsup.ts
|
|
630
|
-
var
|
|
631
|
-
var
|
|
653
|
+
var import_path12 = __toESM(require("path"));
|
|
654
|
+
var import_fs_extra8 = __toESM(require("fs-extra"));
|
|
632
655
|
var import_tsup = require("tsup");
|
|
633
656
|
function runTsup(options) {
|
|
634
657
|
return __async(this, null, function* () {
|
|
635
658
|
var _a;
|
|
636
659
|
const root = process.cwd().replace(/\\/g, "/");
|
|
637
|
-
const filePath =
|
|
660
|
+
const filePath = import_path12.default.posix.join(
|
|
638
661
|
root,
|
|
639
662
|
(options == null ? void 0 : options.config) ? options.config : getDefaultUserConfigName()
|
|
640
663
|
);
|
|
@@ -644,9 +667,9 @@ function runTsup(options) {
|
|
|
644
667
|
return;
|
|
645
668
|
}
|
|
646
669
|
const outDir = userConfig.tsup.outDir || "lib";
|
|
647
|
-
const outPath =
|
|
648
|
-
|
|
649
|
-
|
|
670
|
+
const outPath = import_path12.default.posix.join(root, outDir);
|
|
671
|
+
import_fs_extra8.default.ensureDirSync(outPath);
|
|
672
|
+
import_fs_extra8.default.emptyDirSync(outPath);
|
|
650
673
|
for (const target of userConfig.tsup.targets) {
|
|
651
674
|
yield (0, import_tsup.build)(__spreadValues({
|
|
652
675
|
entry: [
|
|
@@ -656,15 +679,13 @@ function runTsup(options) {
|
|
|
656
679
|
"!**/__tests__",
|
|
657
680
|
"!**/*.test.*"
|
|
658
681
|
],
|
|
659
|
-
outDir:
|
|
682
|
+
outDir: import_path12.default.posix.join(root, outDir, "cjs", target.relativeOutDir || ""),
|
|
660
683
|
format: ["cjs"],
|
|
661
684
|
dts: true,
|
|
662
685
|
sourcemap: false,
|
|
663
686
|
clean: false,
|
|
664
687
|
minify: false,
|
|
665
688
|
bundle: false,
|
|
666
|
-
target: "node16",
|
|
667
|
-
platform: "node",
|
|
668
689
|
outExtension: () => ({ js: ".js", dts: ".d.ts" })
|
|
669
690
|
}, userConfig.tsup.options));
|
|
670
691
|
}
|
|
@@ -677,15 +698,13 @@ function runTsup(options) {
|
|
|
677
698
|
"!**/__tests__",
|
|
678
699
|
"!**/*.test.*"
|
|
679
700
|
],
|
|
680
|
-
outDir:
|
|
701
|
+
outDir: import_path12.default.posix.join(root, outDir, "esm", target.relativeOutDir || ""),
|
|
681
702
|
format: ["esm"],
|
|
682
703
|
dts: true,
|
|
683
704
|
sourcemap: false,
|
|
684
705
|
clean: false,
|
|
685
706
|
minify: false,
|
|
686
707
|
bundle: false,
|
|
687
|
-
target: "node16",
|
|
688
|
-
platform: "node",
|
|
689
708
|
outExtension: () => ({ js: ".js", dts: ".d.ts" })
|
|
690
709
|
}, userConfig.tsup.options));
|
|
691
710
|
}
|