@ngrs/build 0.2.0 → 0.3.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.
package/bin/ngrs-build.mjs
CHANGED
|
@@ -4,19 +4,16 @@ import fs from 'node:fs';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import {
|
|
7
|
-
buildApplication,
|
|
8
7
|
createConsoleLogger,
|
|
9
8
|
createWorkspaceBuilderContext,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
initWorkspaceWithNgrsBuild,
|
|
9
|
+
} from '../src/architect-compat.mjs';
|
|
10
|
+
import {
|
|
13
11
|
loadWorkspace,
|
|
14
12
|
normalizeApplicationOptions,
|
|
15
13
|
normalizeDevServerOptions,
|
|
16
14
|
resolveProjectName,
|
|
17
15
|
resolveTargetOptions,
|
|
18
|
-
|
|
19
|
-
} from '../src/index.mjs';
|
|
16
|
+
} from '../src/workspace.mjs';
|
|
20
17
|
|
|
21
18
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
19
|
const pkgJson = JSON.parse(
|
|
@@ -418,6 +415,7 @@ async function main() {
|
|
|
418
415
|
const logger = createConsoleLogger(Boolean(parsed.overrides.verbose));
|
|
419
416
|
|
|
420
417
|
if (parsed.command === 'init') {
|
|
418
|
+
const { initWorkspaceWithNgrsBuild } = await import('../src/ng-add.mjs');
|
|
421
419
|
await initWorkspaceWithNgrsBuild({
|
|
422
420
|
workspaceRoot: process.cwd(),
|
|
423
421
|
project: parsed.project,
|
|
@@ -431,6 +429,7 @@ async function main() {
|
|
|
431
429
|
const projectName = resolveProjectName(loaded.workspace, parsed.project);
|
|
432
430
|
|
|
433
431
|
if (parsed.command === 'build') {
|
|
432
|
+
const { buildApplication } = await import('../src/builders/application/index.mjs');
|
|
434
433
|
const targetSpec = {
|
|
435
434
|
project: projectName,
|
|
436
435
|
target: 'build',
|
|
@@ -523,6 +522,7 @@ async function main() {
|
|
|
523
522
|
normalizedServe.buildTarget.project,
|
|
524
523
|
);
|
|
525
524
|
|
|
525
|
+
const { startDevServer } = await import('../src/builders/dev-server/index.mjs');
|
|
526
526
|
const started = await startDevServer(normalizedServe, normalizedApp, logger);
|
|
527
527
|
|
|
528
528
|
const shutdown = async () => {
|
|
@@ -563,6 +563,7 @@ async function main() {
|
|
|
563
563
|
logger,
|
|
564
564
|
});
|
|
565
565
|
|
|
566
|
+
const { executeUnitTestBuilder } = await import('../src/builders/unit-test/index.mjs');
|
|
566
567
|
let lastSuccess = true;
|
|
567
568
|
for await (const output of executeUnitTestBuilder(mergedTestOpts, context)) {
|
|
568
569
|
lastSuccess = Boolean(output?.success);
|
|
@@ -575,6 +576,7 @@ async function main() {
|
|
|
575
576
|
}
|
|
576
577
|
|
|
577
578
|
if (parsed.command === 'extract-i18n') {
|
|
579
|
+
const { executeExtractI18nBuilder } = await import('../src/builders/extract-i18n/index.mjs');
|
|
578
580
|
const context = createWorkspaceBuilderContext({
|
|
579
581
|
workspaceRoot: loaded.workspaceRoot,
|
|
580
582
|
workspace: loaded.workspace,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrs/build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "1:1 Angular CLI compatible Application Builder, Vite Dev-Server & CLI powered by @ngrs/compiler and @ngrs/vite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"builders": "./builders.json",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"src"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@ngrs/compiler": "0.
|
|
56
|
-
"@ngrs/vite": "0.
|
|
55
|
+
"@ngrs/compiler": "0.3.0",
|
|
56
|
+
"@ngrs/vite": "0.3.0",
|
|
57
57
|
"happy-dom": "^20.0.0",
|
|
58
58
|
"jsonc-parser": "^3.3.1",
|
|
59
59
|
"mrmime": "^2.0.1",
|
|
@@ -369,6 +369,9 @@ export async function executeApplicationBuild(
|
|
|
369
369
|
|
|
370
370
|
/** @type {Array<{ file: string, css: string, size: number }>} */
|
|
371
371
|
let collectedComponentStyles = [];
|
|
372
|
+
const hasComponentStyleBudget =
|
|
373
|
+
Array.isArray(appOptions.budgets) &&
|
|
374
|
+
appOptions.budgets.some((b) => b?.type === 'anyComponentStyle');
|
|
372
375
|
|
|
373
376
|
const entryInputs = {
|
|
374
377
|
...(appOptions.polyfills.length > 0 ? { polyfills: VIRTUAL_POLYFILLS_ID } : {}),
|
|
@@ -461,10 +464,15 @@ export async function executeApplicationBuild(
|
|
|
461
464
|
stylePreprocessorOptions: appOptions.stylePreprocessorOptions,
|
|
462
465
|
jit: !appOptions.aot,
|
|
463
466
|
suppressViteDiagnosticsLog: true,
|
|
467
|
+
_skipBuildTransform: !appOptions.watch,
|
|
464
468
|
onDiagnostics: recordDiagnostics,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
469
|
+
...(hasComponentStyleBudget
|
|
470
|
+
? {
|
|
471
|
+
onComponentStylesCollected(styles) {
|
|
472
|
+
collectedComponentStyles = styles;
|
|
473
|
+
},
|
|
474
|
+
}
|
|
475
|
+
: {}),
|
|
468
476
|
}),
|
|
469
477
|
...(extensions?.plugins || []),
|
|
470
478
|
],
|
|
@@ -97,7 +97,7 @@ function resolveLocalModulePath(fromFile, specifier, replacementMap) {
|
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Computes initial dev-mode bundle statistics (`Initial chunk files` + `Lazy chunk files`) in
|
|
100
|
-
* sub-millisecond time directly from `
|
|
100
|
+
* sub-millisecond time directly from `NgrsProgram`'s warm emitted JS graph + global entries.
|
|
101
101
|
*/
|
|
102
102
|
async function collectDevServerInitialStats(compiler, appOptions) {
|
|
103
103
|
const replacementMap = new Map();
|
package/src/stats-table.mjs
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { WriteStream } from 'node:tty';
|
|
3
3
|
import { stripVTControlCharacters } from 'node:util';
|
|
4
|
-
import { brotliCompress } from 'node:zlib';
|
|
4
|
+
import { brotliCompress, constants as zlibConstants } from 'node:zlib';
|
|
5
5
|
import { formatSize } from './budgets.mjs';
|
|
6
6
|
|
|
7
|
+
const FAST_BROTLI_OPTIONS = {
|
|
8
|
+
params: {
|
|
9
|
+
[zlibConstants.BROTLI_PARAM_QUALITY]: 4,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
7
13
|
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
8
14
|
|
|
9
15
|
export const ansiColors = {
|
|
@@ -135,7 +141,7 @@ export async function calculateEstimatedTransferSizes(outputFiles) {
|
|
|
135
141
|
continue;
|
|
136
142
|
}
|
|
137
143
|
|
|
138
|
-
brotliCompress(buf, (error, result) => {
|
|
144
|
+
brotliCompress(buf, FAST_BROTLI_OPTIONS, (error, result) => {
|
|
139
145
|
if (error) {
|
|
140
146
|
reject(error);
|
|
141
147
|
return;
|