@jsenv/core 39.4.1 → 39.5.1

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.
@@ -2915,13 +2915,19 @@ const applyAssociations = ({ url, associations }) => {
2915
2915
  };
2916
2916
 
2917
2917
  const deepAssign = (firstValue, secondValue) => {
2918
- if (!isPlainObject(firstValue) || !isPlainObject(secondValue)) {
2918
+ if (!isPlainObject(firstValue)) {
2919
+ if (isPlainObject(secondValue)) {
2920
+ return deepAssign({}, secondValue);
2921
+ }
2922
+ return secondValue;
2923
+ }
2924
+ if (!isPlainObject(secondValue)) {
2919
2925
  return secondValue;
2920
2926
  }
2921
2927
  for (const key of Object.keys(secondValue)) {
2922
- const leftValue = firstValue[key];
2923
- const rightValue = secondValue[key];
2924
- firstValue[key] = deepAssign(leftValue, rightValue);
2928
+ const leftPopertyValue = firstValue[key];
2929
+ const rightPropertyValue = secondValue[key];
2930
+ firstValue[key] = deepAssign(leftPopertyValue, rightPropertyValue);
2925
2931
  }
2926
2932
  return firstValue;
2927
2933
  };
@@ -22116,6 +22122,11 @@ const defaultRuntimeCompat = {
22116
22122
  safari: "11.3",
22117
22123
  samsung: "9.2",
22118
22124
  };
22125
+ const logsDefault = {
22126
+ level: "info",
22127
+ disabled: false,
22128
+ animation: true,
22129
+ };
22119
22130
 
22120
22131
  /**
22121
22132
  * Generate an optimized version of source files into a directory
@@ -22154,11 +22165,7 @@ const defaultRuntimeCompat = {
22154
22165
  const build = async ({
22155
22166
  signal = new AbortController().signal,
22156
22167
  handleSIGINT = true,
22157
- logLevel = "info",
22158
- logs = {
22159
- disabled: false,
22160
- animation: true,
22161
- },
22168
+ logs = logsDefault,
22162
22169
  sourceDirectoryUrl,
22163
22170
  buildDirectoryUrl,
22164
22171
  entryPoints = {},
@@ -22208,6 +22215,21 @@ const build = async ({
22208
22215
  `${unexpectedParamNames.join(",")}: there is no such param`,
22209
22216
  );
22210
22217
  }
22218
+ // logs
22219
+ {
22220
+ if (typeof logs !== "object") {
22221
+ throw new TypeError(`logs must be an object, got ${logs}`);
22222
+ }
22223
+ const unexpectedLogsKeys = Object.keys(logs).filter(
22224
+ (key) => !Object.hasOwn(logsDefault, key),
22225
+ );
22226
+ if (unexpectedLogsKeys.length > 0) {
22227
+ throw new TypeError(
22228
+ `${unexpectedLogsKeys.join(",")}: no such key on logs`,
22229
+ );
22230
+ }
22231
+ logs = { ...logsDefault, ...logs };
22232
+ }
22211
22233
  sourceDirectoryUrl = assertAndNormalizeDirectoryUrl(
22212
22234
  sourceDirectoryUrl,
22213
22235
  "sourceDirectoryUrl",
@@ -22336,7 +22358,7 @@ build ${entryPointKeys.length} entry points`);
22336
22358
  };
22337
22359
  const rawKitchen = createKitchen({
22338
22360
  signal,
22339
- logLevel,
22361
+ logLevel: logs.level,
22340
22362
  rootDirectoryUrl: sourceDirectoryUrl,
22341
22363
  ignore,
22342
22364
  // during first pass (craft) we keep "ignore:" when a reference is ignored
@@ -22416,7 +22438,7 @@ build ${entryPointKeys.length} entry points`);
22416
22438
 
22417
22439
  const finalKitchen = createKitchen({
22418
22440
  name: "shape",
22419
- logLevel,
22441
+ logLevel: logs.level,
22420
22442
  rootDirectoryUrl: sourceDirectoryUrl,
22421
22443
  // here most plugins are not there
22422
22444
  // - no external plugin
@@ -22741,7 +22763,7 @@ build ${entryPointKeys.length} entry points`);
22741
22763
  try {
22742
22764
  const result = await runBuild({
22743
22765
  signal: operation.signal,
22744
- logLevel,
22766
+ logLevel: logs.level,
22745
22767
  });
22746
22768
  return result;
22747
22769
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "39.4.1",
3
+ "version": "39.5.1",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -47,7 +47,7 @@
47
47
  "eslint": "npx eslint .",
48
48
  "test": "node --conditions=development ./scripts/test/test.mjs",
49
49
  "build": "node --conditions=development ./scripts/build/build.mjs",
50
- "workspace:test": "npm run test --workspaces --if-present -- --workspace",
50
+ "packages:test": "npm run test -- ./packages/",
51
51
  "workspace:build": "npm run build --workspaces --if-present --conditions=developement",
52
52
  "monorepo:sync_packages_versions": "node ./scripts/monorepo/sync_packages_versions.mjs",
53
53
  "monorepo:publish": "node ./scripts/monorepo/publish_packages.mjs",
@@ -70,20 +70,20 @@
70
70
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
71
71
  "@jsenv/abort": "4.3.0",
72
72
  "@jsenv/ast": "6.2.17",
73
- "@jsenv/filesystem": "4.10.2",
73
+ "@jsenv/filesystem": "4.10.3",
74
74
  "@jsenv/humanize": "1.2.8",
75
75
  "@jsenv/importmap": "1.2.1",
76
76
  "@jsenv/integrity": "0.0.2",
77
77
  "@jsenv/js-module-fallback": "1.3.38",
78
78
  "@jsenv/node-esm-resolution": "1.0.6",
79
- "@jsenv/plugin-bundling": "2.7.7",
79
+ "@jsenv/plugin-bundling": "2.7.8",
80
80
  "@jsenv/plugin-minification": "1.5.5",
81
81
  "@jsenv/plugin-supervisor": "1.5.19",
82
82
  "@jsenv/plugin-transpilation": "1.4.22",
83
83
  "@jsenv/runtime-compat": "1.3.1",
84
- "@jsenv/server": "15.3.0",
84
+ "@jsenv/server": "15.3.1",
85
85
  "@jsenv/sourcemap": "1.2.23",
86
- "@jsenv/url-meta": "8.5.1",
86
+ "@jsenv/url-meta": "8.5.2",
87
87
  "@jsenv/urls": "2.5.2",
88
88
  "@jsenv/utils": "2.1.2",
89
89
  "string-width": "7.2.0",
@@ -54,6 +54,11 @@ export const defaultRuntimeCompat = {
54
54
  safari: "11.3",
55
55
  samsung: "9.2",
56
56
  };
57
+ const logsDefault = {
58
+ level: "info",
59
+ disabled: false,
60
+ animation: true,
61
+ };
57
62
 
58
63
  /**
59
64
  * Generate an optimized version of source files into a directory
@@ -92,11 +97,7 @@ export const defaultRuntimeCompat = {
92
97
  export const build = async ({
93
98
  signal = new AbortController().signal,
94
99
  handleSIGINT = true,
95
- logLevel = "info",
96
- logs = {
97
- disabled: false,
98
- animation: true,
99
- },
100
+ logs = logsDefault,
100
101
  sourceDirectoryUrl,
101
102
  buildDirectoryUrl,
102
103
  entryPoints = {},
@@ -146,6 +147,21 @@ export const build = async ({
146
147
  `${unexpectedParamNames.join(",")}: there is no such param`,
147
148
  );
148
149
  }
150
+ // logs
151
+ {
152
+ if (typeof logs !== "object") {
153
+ throw new TypeError(`logs must be an object, got ${logs}`);
154
+ }
155
+ const unexpectedLogsKeys = Object.keys(logs).filter(
156
+ (key) => !Object.hasOwn(logsDefault, key),
157
+ );
158
+ if (unexpectedLogsKeys.length > 0) {
159
+ throw new TypeError(
160
+ `${unexpectedLogsKeys.join(",")}: no such key on logs`,
161
+ );
162
+ }
163
+ logs = { ...logsDefault, ...logs };
164
+ }
149
165
  sourceDirectoryUrl = assertAndNormalizeDirectoryUrl(
150
166
  sourceDirectoryUrl,
151
167
  "sourceDirectoryUrl",
@@ -274,7 +290,7 @@ build ${entryPointKeys.length} entry points`);
274
290
  };
275
291
  const rawKitchen = createKitchen({
276
292
  signal,
277
- logLevel,
293
+ logLevel: logs.level,
278
294
  rootDirectoryUrl: sourceDirectoryUrl,
279
295
  ignore,
280
296
  // during first pass (craft) we keep "ignore:" when a reference is ignored
@@ -354,7 +370,7 @@ build ${entryPointKeys.length} entry points`);
354
370
 
355
371
  const finalKitchen = createKitchen({
356
372
  name: "shape",
357
- logLevel,
373
+ logLevel: logs.level,
358
374
  rootDirectoryUrl: sourceDirectoryUrl,
359
375
  // here most plugins are not there
360
376
  // - no external plugin
@@ -681,7 +697,7 @@ build ${entryPointKeys.length} entry points`);
681
697
  try {
682
698
  const result = await runBuild({
683
699
  signal: operation.signal,
684
- logLevel,
700
+ logLevel: logs.level,
685
701
  });
686
702
  return result;
687
703
  } finally {