@loomweaver/cli 0.9.1 → 0.9.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/dist/main.mjs +80 -9
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -98,7 +98,7 @@ function ensureBuildTarget(target, amendment, projectRoot) {
|
|
|
98
98
|
added.push(...assets.added.map((entry) => `assets: ${entry}`));
|
|
99
99
|
}
|
|
100
100
|
next["options"] = options;
|
|
101
|
-
if (amendment.inlineCritical !== void 0 || amendment.serviceWorker) {
|
|
101
|
+
if (amendment.inlineCritical !== void 0 || amendment.serviceWorker || amendment.initialBudget) {
|
|
102
102
|
const configurations = { ...asObject(next["configurations"]) };
|
|
103
103
|
const production = { ...asObject(configurations["production"]) };
|
|
104
104
|
if (amendment.serviceWorker && production["serviceWorker"] === void 0) {
|
|
@@ -124,6 +124,18 @@ function ensureBuildTarget(target, amendment, projectRoot) {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
+
if (amendment.initialBudget) {
|
|
128
|
+
const budgets = ensureInitialBudget(
|
|
129
|
+
production["budgets"],
|
|
130
|
+
amendment.initialBudget
|
|
131
|
+
);
|
|
132
|
+
if (budgets.changed) {
|
|
133
|
+
production["budgets"] = budgets.value;
|
|
134
|
+
added.push(
|
|
135
|
+
`production budget initial: ${amendment.initialBudget.warning} warning, ${amendment.initialBudget.error} error`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
127
139
|
configurations["production"] = production;
|
|
128
140
|
next["configurations"] = configurations;
|
|
129
141
|
}
|
|
@@ -139,6 +151,56 @@ function ensureStylesheetSource(css, source) {
|
|
|
139
151
|
@source '${source}';
|
|
140
152
|
`;
|
|
141
153
|
}
|
|
154
|
+
function ensureInitialBudget(budgets, wanted) {
|
|
155
|
+
const entries = Array.isArray(budgets) ? [...budgets] : [];
|
|
156
|
+
const index = entries.findIndex(
|
|
157
|
+
(entry) => asObject(entry)?.["type"] === "initial"
|
|
158
|
+
);
|
|
159
|
+
if (index === -1) {
|
|
160
|
+
return {
|
|
161
|
+
value: [
|
|
162
|
+
...entries,
|
|
163
|
+
{
|
|
164
|
+
type: "initial",
|
|
165
|
+
maximumWarning: wanted.warning,
|
|
166
|
+
maximumError: wanted.error
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
changed: true
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
const current = asObject(entries[index]) ?? {};
|
|
173
|
+
if (!isBelow(current["maximumError"], wanted.error)) {
|
|
174
|
+
return { value: entries, changed: false };
|
|
175
|
+
}
|
|
176
|
+
entries[index] = {
|
|
177
|
+
...current,
|
|
178
|
+
maximumWarning: wanted.warning,
|
|
179
|
+
maximumError: wanted.error
|
|
180
|
+
};
|
|
181
|
+
return { value: entries, changed: true };
|
|
182
|
+
}
|
|
183
|
+
function isBelow(recorded, wanted) {
|
|
184
|
+
const left = toBytes(recorded);
|
|
185
|
+
const right = toBytes(wanted);
|
|
186
|
+
return left !== void 0 && right !== void 0 && left < right;
|
|
187
|
+
}
|
|
188
|
+
function toBytes(size) {
|
|
189
|
+
if (typeof size !== "string") {
|
|
190
|
+
return void 0;
|
|
191
|
+
}
|
|
192
|
+
const match = /^([\d.]+)\s*(b|kb|mb|gb)?$/i.exec(size.trim());
|
|
193
|
+
if (!match) {
|
|
194
|
+
return void 0;
|
|
195
|
+
}
|
|
196
|
+
const units = {
|
|
197
|
+
b: 1,
|
|
198
|
+
kb: 1e3,
|
|
199
|
+
mb: 1e3 * 1e3,
|
|
200
|
+
gb: 1e3 * 1e3 * 1e3
|
|
201
|
+
};
|
|
202
|
+
return Number(match[1]) * units[(match[2] ?? "b").toLowerCase()];
|
|
203
|
+
}
|
|
142
204
|
function ensureInlineCritical(optimization, inlineCritical) {
|
|
143
205
|
if (typeof optimization === "boolean") {
|
|
144
206
|
return { value: optimization, changed: false, declined: true };
|
|
@@ -363,7 +425,10 @@ function describeAmendment(amendment) {
|
|
|
363
425
|
] : [],
|
|
364
426
|
...amendment.inlineCritical === void 0 ? [] : [
|
|
365
427
|
`set optimization.styles.inlineCritical to ${amendment.inlineCritical} in the production configuration (the generated content-security policy blocks the inline handler Angular's critical-CSS pass attaches, so a release build renders unstyled)`
|
|
366
|
-
]
|
|
428
|
+
],
|
|
429
|
+
...amendment.initialBudget ? [
|
|
430
|
+
`raise the initial bundle budget to ${amendment.initialBudget.warning} warning and ${amendment.initialBudget.error} error in the production configuration (a fresh workspace carries one sized for an empty application, and the workbench alone spends almost all of it, so a release build fails)`
|
|
431
|
+
] : []
|
|
367
432
|
].map((step, index) => `${index + 1}. ${step}`).join(" ");
|
|
368
433
|
}
|
|
369
434
|
|
|
@@ -755,7 +820,7 @@ function pause(): Promise<void> {
|
|
|
755
820
|
}
|
|
756
821
|
|
|
757
822
|
// ../devkit/src/recipes/angular-weaver/agent-files.ts
|
|
758
|
-
var AG_UI_ADAPTER_VERSION = "0.9.
|
|
823
|
+
var AG_UI_ADAPTER_VERSION = "0.9.2";
|
|
759
824
|
var AG_UI_PROTOCOL_VERSION = "0.0.x";
|
|
760
825
|
function connectionFile(w) {
|
|
761
826
|
return `import { signal } from '@angular/core';
|
|
@@ -1738,9 +1803,13 @@ var framePlugin = {
|
|
|
1738
1803
|
};
|
|
1739
1804
|
|
|
1740
1805
|
// ../devkit/src/recipes/platform-version.ts
|
|
1741
|
-
var PLATFORM_VERSION = "0.9.
|
|
1806
|
+
var PLATFORM_VERSION = "0.9.2";
|
|
1742
1807
|
|
|
1743
1808
|
// ../devkit/src/recipes/angular-distribution/amendments.ts
|
|
1809
|
+
var DISTRIBUTION_INITIAL_BUDGET = {
|
|
1810
|
+
warning: "1.5MB",
|
|
1811
|
+
error: "2MB"
|
|
1812
|
+
};
|
|
1744
1813
|
function distributionAmendments(d) {
|
|
1745
1814
|
return [
|
|
1746
1815
|
{
|
|
@@ -1774,7 +1843,8 @@ function distributionAmendments(d) {
|
|
|
1774
1843
|
}
|
|
1775
1844
|
],
|
|
1776
1845
|
serviceWorker: "ngsw-config.json",
|
|
1777
|
-
inlineCritical: false
|
|
1846
|
+
inlineCritical: false,
|
|
1847
|
+
initialBudget: DISTRIBUTION_INITIAL_BUDGET
|
|
1778
1848
|
}
|
|
1779
1849
|
];
|
|
1780
1850
|
}
|
|
@@ -1969,9 +2039,10 @@ function readme2(d) {
|
|
|
1969
2039
|
"the stylesheet with an **inline** `onload` handler that the policy blocks \u2014 the app then renders",
|
|
1970
2040
|
"completely unstyled, and only in production builds.",
|
|
1971
2041
|
"",
|
|
1972
|
-
"
|
|
1973
|
-
"
|
|
1974
|
-
"
|
|
2042
|
+
"The initial-bundle budget in your build target was raised for the same reason: the shell is a",
|
|
2043
|
+
"whole application chrome and spends most of Angular's default before your own code arrives, so",
|
|
2044
|
+
"a production build would have failed on a number meant for an empty app. It is still a budget,",
|
|
2045
|
+
"and it is yours to move.",
|
|
1975
2046
|
"",
|
|
1976
2047
|
"## Ship less than the whole workbench",
|
|
1977
2048
|
"",
|
|
@@ -4229,7 +4300,7 @@ function replaceSymlinkEntry(absolute) {
|
|
|
4229
4300
|
}
|
|
4230
4301
|
|
|
4231
4302
|
// src/lib/run.ts
|
|
4232
|
-
var VERSION = "0.9.
|
|
4303
|
+
var VERSION = "0.9.2";
|
|
4233
4304
|
function help() {
|
|
4234
4305
|
const commands = SCAFFOLDS.map((s) => ` ${s.name.padEnd(16)}${s.summary}`);
|
|
4235
4306
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomweaver/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "LoomWeaver: open-source plugin platform for Angular workbenches. The scaffolding CLI: generates weavers, distributions and integrations into any project, with no Nx workspace and no checkout required.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loomweaver",
|