@modern-js/ssg-generator 3.1.25 → 3.1.27
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.js +18 -48
- package/package.json +7 -7
- package/src/index.ts +13 -4
package/dist/index.js
CHANGED
@@ -115163,6 +115163,9 @@ var require_path = __commonJS({
|
|
115163
115163
|
},
|
115164
115164
|
removeSlash: function() {
|
115165
115165
|
return removeSlash;
|
115166
|
+
},
|
115167
|
+
cutNameByHyphen: function() {
|
115168
|
+
return cutNameByHyphen;
|
115166
115169
|
}
|
115167
115170
|
});
|
115168
115171
|
var _interop_require_default = require_interop_require_default();
|
@@ -115212,6 +115215,9 @@ var require_path = __commonJS({
|
|
115212
115215
|
var removeLeadingSlash = (s) => s.replace(/^\/+/, "");
|
115213
115216
|
var removeTailSlash = (s) => s.replace(/\/+$/, "");
|
115214
115217
|
var removeSlash = (s) => removeLeadingSlash(removeTailSlash(s));
|
115218
|
+
var cutNameByHyphen = (s) => {
|
115219
|
+
return s.split(/[-_]/)[0];
|
115220
|
+
};
|
115215
115221
|
}
|
115216
115222
|
});
|
115217
115223
|
|
@@ -115687,49 +115693,6 @@ var require_prettyInstructions = __commonJS({
|
|
115687
115693
|
}
|
115688
115694
|
});
|
115689
115695
|
|
115690
|
-
// ../../../toolkit/utils/dist/cjs/cli/print.js
|
115691
|
-
var require_print = __commonJS({
|
115692
|
-
"../../../toolkit/utils/dist/cjs/cli/print.js"(exports) {
|
115693
|
-
"use strict";
|
115694
|
-
Object.defineProperty(exports, "__esModule", {
|
115695
|
-
value: true
|
115696
|
-
});
|
115697
|
-
Object.defineProperty(exports, "printBuildError", {
|
115698
|
-
enumerable: true,
|
115699
|
-
get: function() {
|
115700
|
-
return printBuildError;
|
115701
|
-
}
|
115702
|
-
});
|
115703
|
-
var _compiled = require_compiled();
|
115704
|
-
var _logger = require_logger2();
|
115705
|
-
function printBuildError(err) {
|
115706
|
-
const message = err != null && err.message;
|
115707
|
-
const stack = err != null && err.stack;
|
115708
|
-
if (stack && typeof message === "string" && message.indexOf("from Terser") !== -1) {
|
115709
|
-
try {
|
115710
|
-
const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
|
115711
|
-
if (!matched) {
|
115712
|
-
throw new Error("Using errors for control flow is bad.");
|
115713
|
-
}
|
115714
|
-
const problemPath = matched[2];
|
115715
|
-
const line = matched[3];
|
115716
|
-
const column = matched[4];
|
115717
|
-
_logger.logger.error(`Failed to minify the code from this file:
|
115718
|
-
|
115719
|
-
${_compiled.chalk.yellow(` ${problemPath}:${line}${column !== "0" ? ":" + column : ""}`)}
|
115720
|
-
`);
|
115721
|
-
} catch (ignored) {
|
115722
|
-
_logger.logger.error(`Failed to minify the bundle. ${err}
|
115723
|
-
`);
|
115724
|
-
}
|
115725
|
-
} else {
|
115726
|
-
_logger.logger.error((message || err) + "\n");
|
115727
|
-
}
|
115728
|
-
_logger.logger.log();
|
115729
|
-
}
|
115730
|
-
}
|
115731
|
-
});
|
115732
|
-
|
115733
115696
|
// ../../../toolkit/utils/dist/cjs/cli/require.js
|
115734
115697
|
var require_require = __commonJS({
|
115735
115698
|
"../../../toolkit/utils/dist/cjs/cli/require.js"(exports, module2) {
|
@@ -115962,7 +115925,6 @@ var require_cli = __commonJS({
|
|
115962
115925
|
_export_star._(require_pathSerializer(), exports);
|
115963
115926
|
_export_star._(require_port(), exports);
|
115964
115927
|
_export_star._(require_prettyInstructions(), exports);
|
115965
|
-
_export_star._(require_print(), exports);
|
115966
115928
|
_export_star._(require_require(), exports);
|
115967
115929
|
_export_star._(require_runtimeExports(), exports);
|
115968
115930
|
_export_star._(require_watch(), exports);
|
@@ -131217,7 +131179,7 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
|
|
131217
131179
|
const appDir = context.materials.default.basePath;
|
131218
131180
|
const configFile = yield getModernConfigFile(appDir);
|
131219
131181
|
const isTS = configFile.endsWith("ts");
|
131220
|
-
const { pluginName, pluginDependence } = context.config;
|
131182
|
+
const { pluginName, pluginDependence, shouldUsePluginNameExport } = context.config;
|
131221
131183
|
console.info(
|
131222
131184
|
import_utils16.chalk.green(`
|
131223
131185
|
[INFO]`),
|
@@ -131226,9 +131188,17 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
|
|
131226
131188
|
":",
|
131227
131189
|
"\n"
|
131228
131190
|
);
|
131229
|
-
|
131230
|
-
|
131231
|
-
|
131191
|
+
if (shouldUsePluginNameExport) {
|
131192
|
+
console.info(
|
131193
|
+
import_utils16.chalk.yellow.bold(
|
131194
|
+
`import { ${pluginName} } from '${pluginDependence}';`
|
131195
|
+
)
|
131196
|
+
);
|
131197
|
+
} else {
|
131198
|
+
console.info(
|
131199
|
+
import_utils16.chalk.yellow.bold(`import ${pluginName} from '${pluginDependence}';`)
|
131200
|
+
);
|
131201
|
+
}
|
131232
131202
|
if (isTS) {
|
131233
131203
|
console.info(`
|
131234
131204
|
export default defineConfig({
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "3.1.
|
18
|
+
"version": "3.1.27",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"main": "./dist/index.js",
|
21
21
|
"files": [
|
@@ -29,12 +29,12 @@
|
|
29
29
|
"@types/node": "^14",
|
30
30
|
"jest": "^29",
|
31
31
|
"typescript": "^5",
|
32
|
-
"@modern-js/generator
|
33
|
-
"@modern-js/plugin-i18n": "2.
|
34
|
-
"@modern-js/generator-utils": "3.1.
|
35
|
-
"@modern-js/
|
36
|
-
"@scripts/build": "2.
|
37
|
-
"@scripts/jest-config": "2.
|
32
|
+
"@modern-js/dependence-generator": "3.1.27",
|
33
|
+
"@modern-js/plugin-i18n": "2.25.2",
|
34
|
+
"@modern-js/generator-utils": "3.1.27",
|
35
|
+
"@modern-js/generator-common": "3.1.27",
|
36
|
+
"@scripts/build": "2.25.2",
|
37
|
+
"@scripts/jest-config": "2.25.2"
|
38
38
|
},
|
39
39
|
"sideEffects": false,
|
40
40
|
"publishConfig": {
|
package/src/index.ts
CHANGED
@@ -58,7 +58,8 @@ export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
58
58
|
const appDir = context.materials.default.basePath;
|
59
59
|
const configFile = await getModernConfigFile(appDir);
|
60
60
|
const isTS = configFile.endsWith('ts');
|
61
|
-
const { pluginName, pluginDependence } =
|
61
|
+
const { pluginName, pluginDependence, shouldUsePluginNameExport } =
|
62
|
+
context.config;
|
62
63
|
console.info(
|
63
64
|
chalk.green(`\n[INFO]`),
|
64
65
|
`${i18n.t(localeKeys.success)}`,
|
@@ -66,9 +67,17 @@ export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
66
67
|
':',
|
67
68
|
'\n',
|
68
69
|
);
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
if (shouldUsePluginNameExport) {
|
71
|
+
console.info(
|
72
|
+
chalk.yellow.bold(
|
73
|
+
`import { ${pluginName} } from '${pluginDependence}';`,
|
74
|
+
),
|
75
|
+
);
|
76
|
+
} else {
|
77
|
+
console.info(
|
78
|
+
chalk.yellow.bold(`import ${pluginName} from '${pluginDependence}';`),
|
79
|
+
);
|
80
|
+
}
|
72
81
|
if (isTS) {
|
73
82
|
console.info(`
|
74
83
|
export default defineConfig({
|