@spinnaker/scripts 2026.0.3 → 2026.1.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.
@@ -10,7 +10,7 @@ const autoPrefixer = require('autoprefixer');
10
10
  const postCssColorFix = require('postcss-colorfix');
11
11
  const postCssUrl = require('postcss-url');
12
12
  const esbuild = require('rollup-plugin-esbuild').default;
13
- const { terser } = require('rollup-plugin-terser');
13
+ const terser = require('@rollup/plugin-terser');
14
14
  const { visualizer } = require('rollup-plugin-visualizer');
15
15
 
16
16
  const ROLLUP_STATS = !!process.env.ROLLUP_STATS;
@@ -19,12 +19,17 @@ const NODE_ENV = process.env.NODE_ENV || 'development';
19
19
  const ENV_MINIFY = process.env.ROLLUP_MINIFY;
20
20
  const ROLLUP_MINIFY = ENV_MINIFY === 'true' || (NODE_ENV === 'production' && ENV_MINIFY !== 'false');
21
21
 
22
- // eslint-disable-next-line no-console
23
22
  console.log({ ROLLUP_STATS, ROLLUP_WATCH, ROLLUP_MINIFY, NODE_ENV });
24
23
 
25
24
  const plugins = [
26
25
  nodeResolve(),
27
- commonjs(),
26
+ commonjs({
27
+ // Ensure CommonJS modules that use require() get the full module.exports
28
+ // rather than trying to find a default export (fixes ngimport interop)
29
+ defaultIsModuleExports: true,
30
+ // Treat external ESM dependencies correctly when they're required from CJS
31
+ esmExternals: true,
32
+ }),
28
33
  json(),
29
34
  url({
30
35
  include: ['**/*.html', '**/*.svg', '**/*.png', '**/*.jp(e)?g', '**/*.gif', '**/*.webp'],
package/index.js CHANGED
@@ -3,7 +3,9 @@
3
3
  const chalk = require('chalk');
4
4
  const child_process = require('child_process');
5
5
  const fs = require('fs');
6
- const loadConfigFile = require('rollup/dist/loadConfigFile');
6
+
7
+ const { loadConfigFile } = require('rollup/loadConfigFile');
8
+
7
9
  const ora = require('ora');
8
10
  const path = require('path');
9
11
  const process = require('process');
@@ -12,6 +14,30 @@ const util = require('util');
12
14
 
13
15
  const exec = util.promisify(child_process.exec);
14
16
 
17
+ const ESM_SYNTAX = /^\s*(import\s+|export\s+(default\s+)?)/m;
18
+
19
+ // Rollup 4's loadConfigFile writes temporary .cjs files (named with Date.now()) to the same
20
+ // directory as the config file. When multiple packages build in parallel and share the same
21
+ // config (e.g. rollup.config.base.module.js), one build can delete another's temp file before
22
+ // it's been loaded causing "Cannot find module" errors. To work around this, CJS configs are
23
+ // loaded directly via require() (no temp files), while ESM configs still use loadConfigFile
24
+ // (only used in sequential builds, so safe).
25
+ const loadConfig = async (configPath) => {
26
+ const source = fs.readFileSync(configPath, 'utf8');
27
+ if (ESM_SYNTAX.test(source)) {
28
+ // ESM configs must go through loadConfigFile which bundles them to CJS.
29
+ // These are only used in sequential builds (core, presentation) so no race condition.
30
+ const { options, warnings } = await loadConfigFile(configPath, { bundleConfigAsCjs: true });
31
+ warnings.flush();
32
+ return options;
33
+ }
34
+ // CJS configs can be required directly, avoiding the race condition where
35
+ // parallel builds sharing the same config collide on temp .cjs files.
36
+ delete require.cache[require.resolve(configPath)];
37
+ const config = require(configPath);
38
+ return Array.isArray(config) ? config : [config];
39
+ };
40
+
15
41
  const getRollupConfigPath = (file) => {
16
42
  if (file && !fs.existsSync(path.resolve(path.join('.', file)))) {
17
43
  // If the user explicitly provides a rollup config file and if it is not available, then throw an error and exit.
@@ -65,15 +91,13 @@ const runTsc = (options, exitOnFailure) => {
65
91
  const startHandler = async ({ file, push }) => {
66
92
  process.env.ROLLUP_WATCH = true;
67
93
 
68
- const { options, warnings } = await loadConfigFile(getRollupConfigPath(file));
94
+ const options = await loadConfig(getRollupConfigPath(file));
69
95
  // A map of `input-output` bundle key to a tracker object. This is used to quickly access a spinner object and
70
96
  // startTime when succeeding/failing that object on receiving a `BUNDLE_END`/`ERROR` event.
71
97
  const buildTracker = {};
72
98
  // Kick-starting rollup's bundling process in watch mode.
73
99
  const watcher = rollup.watch(options);
74
100
  let startTime;
75
-
76
- warnings.flush();
77
101
  watcher.on('event', (event) => {
78
102
  // Rollup will be emitting lifecycle events for the bundling process such as start, end and error. These events are
79
103
  // used to control a spinner in the terminal for each `input-output` bundle.
@@ -137,8 +161,7 @@ const printBundleComplete = (option, completedTimeInMS) => {
137
161
  };
138
162
 
139
163
  const buildHandler = async ({ file }) => {
140
- const { options, warnings } = await loadConfigFile(getRollupConfigPath(file));
141
- warnings.flush();
164
+ const options = await loadConfig(getRollupConfigPath(file));
142
165
 
143
166
  for (const o of options) {
144
167
  const start = Date.now();
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/spinnaker/spinnaker.git"
6
6
  },
7
- "version": "2026.0.3",
7
+ "version": "2026.1.1",
8
8
  "description": "Spinnaker scripts",
9
9
  "main": "index.js",
10
10
  "bin": {
@@ -20,35 +20,35 @@
20
20
  "author": "",
21
21
  "license": "ISC",
22
22
  "dependencies": {
23
- "@rollup/plugin-commonjs": "^17.0.0",
24
- "@rollup/plugin-json": "4.1.0",
25
- "@rollup/plugin-node-resolve": "^11.0.1",
26
- "@rollup/plugin-replace": "2.4.2",
27
- "@rollup/plugin-typescript": "^8.1.0",
28
- "@rollup/plugin-url": "^6.0.0",
23
+ "@rollup/plugin-commonjs": "^28.0.0",
24
+ "@rollup/plugin-json": "^6.1.0",
25
+ "@rollup/plugin-node-resolve": "^15.0.0",
26
+ "@rollup/plugin-replace": "^6.0.0",
27
+ "@rollup/plugin-terser": "^0.4.0",
28
+ "@rollup/plugin-typescript": "^12.0.0",
29
+ "@rollup/plugin-url": "^8.0.0",
29
30
  "@spinnaker/eslint-plugin": "^3.0.2",
30
31
  "@spinnaker/styleguide": "^2.0.0",
31
32
  "@svgr/rollup": "^6.3.1",
32
33
  "autoprefixer": "^10.4.8",
33
34
  "chalk": "^4.1.1",
34
35
  "comment-json": "^4.1.1",
35
- "esbuild": "^0.12.14",
36
+ "esbuild": "^0.18.0",
36
37
  "ora": "^5.4.0",
37
38
  "postcss": "^8.4.14",
38
39
  "postcss-colorfix": "0.0.5",
39
40
  "postcss-url": "^10.1.3",
40
- "rollup": "^2.79.0",
41
- "rollup-plugin-esbuild": "^4.8.2",
42
- "rollup-plugin-external-globals": "0.6.1",
41
+ "rollup": "^4.59.0",
42
+ "rollup-plugin-esbuild": "^6.2.0",
43
+ "rollup-plugin-external-globals": "^0.13.0",
43
44
  "rollup-plugin-less": "1.1.3",
44
45
  "rollup-plugin-postcss": "^4.0.2",
45
- "rollup-plugin-terser": "7.0.2",
46
- "rollup-plugin-visualizer": "5.4.1",
46
+ "rollup-plugin-visualizer": "^5.14.0",
47
47
  "yalc": "^1.0.0-pre.53",
48
48
  "yargs": "^17.1.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/yargs": "^17.0.3"
52
52
  },
53
- "gitHead": "d7237d64b8696dfcdf1e1eff76b6e59720899cbd"
53
+ "gitHead": "f842aaebe413ea1a14ccec06dd6824e07dc7426b"
54
54
  }
package/.eslintrc.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- 'no-console': 'off',
4
- },
5
- };