@foxford/den 3.1.1 → 3.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/bin/den.cjs +3 -3
- package/bin/den.js +1 -1
- package/builder/index.cjs +2 -2
- package/builder/index.d.cts +4 -0
- package/builder/index.d.ts +4 -0
- package/builder/index.js +1 -1
- package/{chunk-OKRO4G4L.cjs → chunk-LW7IN57F.cjs} +8 -4
- package/{chunk-REFU7UMG.js → chunk-MCMYOVGT.js} +8 -4
- package/package.json +6 -6
package/bin/den.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkLW7IN57Fcjs = require('../chunk-LW7IN57F.cjs');
|
|
5
5
|
require('../chunk-A6ZPAM6Z.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
@@ -69,11 +69,11 @@ function run(argv) {
|
|
|
69
69
|
}
|
|
70
70
|
const target = { base: options["base"], root: (_a = options["root"]) != null ? _a : process.cwd() };
|
|
71
71
|
if (command === "build") {
|
|
72
|
-
yield
|
|
72
|
+
yield _chunkLW7IN57Fcjs.buildApp.call(void 0, target);
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
if (command === "dev") {
|
|
76
|
-
yield
|
|
76
|
+
yield _chunkLW7IN57Fcjs.devApp.call(void 0, target);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
fail(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430 \xAB${command}\xBB`);
|
package/bin/den.js
CHANGED
package/builder/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkLW7IN57Fcjs = require('../chunk-LW7IN57F.cjs');
|
|
6
6
|
require('../chunk-A6ZPAM6Z.cjs');
|
|
7
7
|
require('../chunk-T5QVCXVB.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.buildApp =
|
|
12
|
+
exports.buildApp = _chunkLW7IN57Fcjs.buildApp; exports.defineAppConfig = _chunkLW7IN57Fcjs.defineAppConfig; exports.devApp = _chunkLW7IN57Fcjs.devApp;
|
package/builder/index.d.cts
CHANGED
|
@@ -93,12 +93,16 @@ interface AppConfig {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function defineAppConfig(config: AppConfig): AppConfig;
|
|
95
95
|
|
|
96
|
+
/** Режим сборки: им плагины выбирают рантайм фреймворка. */
|
|
97
|
+
type BuildMode = 'production' | 'development';
|
|
96
98
|
/** Что нужно собрать. */
|
|
97
99
|
interface BuildAppOptions {
|
|
98
100
|
/** Корень приложения. */
|
|
99
101
|
root: string;
|
|
100
102
|
/** Префикс адресов артефактов: в проде CDN, в разработке развязка у хоста. */
|
|
101
103
|
base?: string;
|
|
104
|
+
/** Режим сборки; по умолчанию `production`. */
|
|
105
|
+
mode?: BuildMode;
|
|
102
106
|
}
|
|
103
107
|
/**
|
|
104
108
|
* Собирает приложение целиком.
|
package/builder/index.d.ts
CHANGED
|
@@ -93,12 +93,16 @@ interface AppConfig {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function defineAppConfig(config: AppConfig): AppConfig;
|
|
95
95
|
|
|
96
|
+
/** Режим сборки: им плагины выбирают рантайм фреймворка. */
|
|
97
|
+
type BuildMode = 'production' | 'development';
|
|
96
98
|
/** Что нужно собрать. */
|
|
97
99
|
interface BuildAppOptions {
|
|
98
100
|
/** Корень приложения. */
|
|
99
101
|
root: string;
|
|
100
102
|
/** Префикс адресов артефактов: в проде CDN, в разработке развязка у хоста. */
|
|
101
103
|
base?: string;
|
|
104
|
+
/** Режим сборки; по умолчанию `production`. */
|
|
105
|
+
mode?: BuildMode;
|
|
102
106
|
}
|
|
103
107
|
/**
|
|
104
108
|
* Собирает приложение целиком.
|
package/builder/index.js
CHANGED
|
@@ -179,7 +179,7 @@ function dependenciesOf(root) {
|
|
|
179
179
|
}
|
|
180
180
|
function viteConfigFor(options) {
|
|
181
181
|
var _a, _b, _c;
|
|
182
|
-
const { assets, base, config, configPath, entryFileNames, input, outDir, root, target } = options;
|
|
182
|
+
const { assets, base, config, configPath, entryFileNames, input, mode, outDir, root, target } = options;
|
|
183
183
|
const entry = (_a = config.entry) != null ? _a : "src/index.ts";
|
|
184
184
|
const composed = {
|
|
185
185
|
base,
|
|
@@ -197,6 +197,9 @@ function viteConfigFor(options) {
|
|
|
197
197
|
ssr: target === "server"
|
|
198
198
|
},
|
|
199
199
|
configFile: false,
|
|
200
|
+
// Режим объявляем явно: плагины сборщика выбирают по нему рантайм фреймворка, а через
|
|
201
|
+
// программный вызов он иначе не доедет.
|
|
202
|
+
mode,
|
|
200
203
|
plugins: [...config.preset.plugins, denAppModules({ assets, config, configPath, entry: _path2.default.join(root, entry) })],
|
|
201
204
|
root,
|
|
202
205
|
ssr: { noExternal: (_c = (_b = config.server) == null ? void 0 : _b.noExternal) != null ? _c : [] }
|
|
@@ -206,7 +209,8 @@ function viteConfigFor(options) {
|
|
|
206
209
|
function buildApp(options) {
|
|
207
210
|
return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
|
|
208
211
|
var _a, _b;
|
|
209
|
-
const { base = "/" } = options;
|
|
212
|
+
const { base = "/", mode = "production" } = options;
|
|
213
|
+
process.env["NODE_ENV"] = mode;
|
|
210
214
|
const root = _path2.default.resolve(options.root);
|
|
211
215
|
const { config, configPath } = yield loadAppConfig(root);
|
|
212
216
|
const refusal = (_b = (_a = config.preset).validate) == null ? void 0 : _b.call(_a, dependenciesOf(root));
|
|
@@ -214,7 +218,7 @@ function buildApp(options) {
|
|
|
214
218
|
throw new Error(`den: ${refusal}`);
|
|
215
219
|
}
|
|
216
220
|
const { build } = yield Promise.resolve().then(() => _interopRequireWildcard(require("vite")));
|
|
217
|
-
const shared = { base, config, configPath, root };
|
|
221
|
+
const shared = { base, config, configPath, mode, root };
|
|
218
222
|
const empty = { css: [], js: [] };
|
|
219
223
|
_chunkA6ZPAM6Zcjs.logger.info(`\u0441\u0431\u043E\u0440\u043A\u0430 \u043A\u043B\u0438\u0435\u043D\u0442\u0441\u043A\u043E\u0433\u043E \u0432\u044B\u0445\u043E\u0434\u0430 (${config.preset.view})`);
|
|
220
224
|
yield build(viteConfigFor(_chunkT5QVCXVBcjs.__spreadProps.call(void 0, _chunkT5QVCXVBcjs.__spreadValues.call(void 0, {}, shared), { assets: empty, input: VIRTUAL_CLIENT, outDir: OUT_CLIENT, target: "client" })));
|
|
@@ -309,7 +313,7 @@ function devApp(options) {
|
|
|
309
313
|
dirty = false;
|
|
310
314
|
yield stop();
|
|
311
315
|
try {
|
|
312
|
-
yield buildApp(options);
|
|
316
|
+
yield buildApp(_chunkT5QVCXVBcjs.__spreadProps.call(void 0, _chunkT5QVCXVBcjs.__spreadValues.call(void 0, {}, options), { mode: "development" }));
|
|
313
317
|
start();
|
|
314
318
|
} catch (error) {
|
|
315
319
|
_chunkA6ZPAM6Zcjs.logger.error("\u0441\u0431\u043E\u0440\u043A\u0430 \u043D\u0435 \u043F\u0440\u043E\u0448\u043B\u0430, \u0436\u0434\u0443 \u043F\u0440\u0430\u0432\u043A\u0438:", error);
|
|
@@ -179,7 +179,7 @@ function dependenciesOf(root) {
|
|
|
179
179
|
}
|
|
180
180
|
function viteConfigFor(options) {
|
|
181
181
|
var _a, _b, _c;
|
|
182
|
-
const { assets, base, config, configPath, entryFileNames, input, outDir, root, target } = options;
|
|
182
|
+
const { assets, base, config, configPath, entryFileNames, input, mode, outDir, root, target } = options;
|
|
183
183
|
const entry = (_a = config.entry) != null ? _a : "src/index.ts";
|
|
184
184
|
const composed = {
|
|
185
185
|
base,
|
|
@@ -197,6 +197,9 @@ function viteConfigFor(options) {
|
|
|
197
197
|
ssr: target === "server"
|
|
198
198
|
},
|
|
199
199
|
configFile: false,
|
|
200
|
+
// Режим объявляем явно: плагины сборщика выбирают по нему рантайм фреймворка, а через
|
|
201
|
+
// программный вызов он иначе не доедет.
|
|
202
|
+
mode,
|
|
200
203
|
plugins: [...config.preset.plugins, denAppModules({ assets, config, configPath, entry: path2.join(root, entry) })],
|
|
201
204
|
root,
|
|
202
205
|
ssr: { noExternal: (_c = (_b = config.server) == null ? void 0 : _b.noExternal) != null ? _c : [] }
|
|
@@ -206,7 +209,8 @@ function viteConfigFor(options) {
|
|
|
206
209
|
function buildApp(options) {
|
|
207
210
|
return __async(this, null, function* () {
|
|
208
211
|
var _a, _b;
|
|
209
|
-
const { base = "/" } = options;
|
|
212
|
+
const { base = "/", mode = "production" } = options;
|
|
213
|
+
process.env["NODE_ENV"] = mode;
|
|
210
214
|
const root = path2.resolve(options.root);
|
|
211
215
|
const { config, configPath } = yield loadAppConfig(root);
|
|
212
216
|
const refusal = (_b = (_a = config.preset).validate) == null ? void 0 : _b.call(_a, dependenciesOf(root));
|
|
@@ -214,7 +218,7 @@ function buildApp(options) {
|
|
|
214
218
|
throw new Error(`den: ${refusal}`);
|
|
215
219
|
}
|
|
216
220
|
const { build } = yield import("vite");
|
|
217
|
-
const shared = { base, config, configPath, root };
|
|
221
|
+
const shared = { base, config, configPath, mode, root };
|
|
218
222
|
const empty = { css: [], js: [] };
|
|
219
223
|
logger.info(`\u0441\u0431\u043E\u0440\u043A\u0430 \u043A\u043B\u0438\u0435\u043D\u0442\u0441\u043A\u043E\u0433\u043E \u0432\u044B\u0445\u043E\u0434\u0430 (${config.preset.view})`);
|
|
220
224
|
yield build(viteConfigFor(__spreadProps(__spreadValues({}, shared), { assets: empty, input: VIRTUAL_CLIENT, outDir: OUT_CLIENT, target: "client" })));
|
|
@@ -309,7 +313,7 @@ function devApp(options) {
|
|
|
309
313
|
dirty = false;
|
|
310
314
|
yield stop();
|
|
311
315
|
try {
|
|
312
|
-
yield buildApp(options);
|
|
316
|
+
yield buildApp(__spreadProps(__spreadValues({}, options), { mode: "development" }));
|
|
313
317
|
start();
|
|
314
318
|
} catch (error) {
|
|
315
319
|
logger.error("\u0441\u0431\u043E\u0440\u043A\u0430 \u043D\u0435 \u043F\u0440\u043E\u0448\u043B\u0430, \u0436\u0434\u0443 \u043F\u0440\u0430\u0432\u043A\u0438:", error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/den",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Den — декларативный метафреймворк Foxford (core runtime)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foxford",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"fastify": "^5.11.2",
|
|
27
|
-
"@foxford/
|
|
28
|
-
"@foxford/
|
|
27
|
+
"@foxford/ioc": "^1.1.2",
|
|
28
|
+
"@foxford/logger": "^1.2.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"vite": ">=5.0.0"
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"chunk-A6ZPAM6Z.cjs",
|
|
89
89
|
"chunk-C7BM4DGX.cjs",
|
|
90
90
|
"chunk-E23E2VUC.js",
|
|
91
|
+
"chunk-LW7IN57F.cjs",
|
|
92
|
+
"chunk-MCMYOVGT.js",
|
|
91
93
|
"chunk-MCN4GFEQ.js",
|
|
92
|
-
"chunk-OKRO4G4L.cjs",
|
|
93
|
-
"chunk-REFU7UMG.js",
|
|
94
94
|
"chunk-T5QVCXVB.cjs",
|
|
95
95
|
"chunk-TPBI6TOU.js",
|
|
96
96
|
"chunk-TPHJUDHG.js",
|
|
@@ -125,6 +125,6 @@
|
|
|
125
125
|
"view-adapter-B4gEb-ms.d.ts",
|
|
126
126
|
"view-adapter-DJ7yB6Ml.d.cts"
|
|
127
127
|
],
|
|
128
|
-
"sha": "
|
|
128
|
+
"sha": "a734341",
|
|
129
129
|
"scripts": {}
|
|
130
130
|
}
|