From 864ae8cec142d713c7686e186d0731095521e3f3 Mon Sep 17 00:00:00 2001 From: Pieter Wigboldus Date: Fri, 15 Dec 2023 23:19:00 +0100 Subject: [PATCH 1/2] rollup plugin commonjs is a dev dependency --- packages/ruleset-bundler/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ruleset-bundler/package.json b/packages/ruleset-bundler/package.json index 366dc0e98..2bbc0bee6 100644 --- a/packages/ruleset-bundler/package.json +++ b/packages/ruleset-bundler/package.json @@ -35,7 +35,6 @@ "url": "https://github.com/stoplightio/spectral.git" }, "dependencies": { - "@rollup/plugin-commonjs": "~22.0.2", "@stoplight/path": "1.3.2", "@stoplight/spectral-core": ">=1", "@stoplight/spectral-formats": ">=1", @@ -53,6 +52,7 @@ "validate-npm-package-name": "3.0.0" }, "devDependencies": { + "@rollup/plugin-commonjs": "~22.0.2", "@types/validate-npm-package-name": "^3.0.3", "fetch-mock": "^9.11.0", "memfs": "^3.3.0", From e7f27ff8cea088a33a8a1ec78a2c0e6aac0efa39 Mon Sep 17 00:00:00 2001 From: Pieter Wigboldus Date: Fri, 15 Dec 2023 23:53:25 +0100 Subject: [PATCH 2/2] Move commonjs to cli Update rollup commonjs package to 25 --- karma.conf.ts | 1 - packages/cli/package.json | 1 + .../src/services/linter/utils}/commonjs.ts | 0 .../src/services/linter/utils/getRuleset.ts | 2 +- packages/ruleset-bundler/package.json | 3 +- .../src/__tests__/index.jest.test.ts | 2 +- yarn.lock | 101 +++++++++++------- 7 files changed, 70 insertions(+), 40 deletions(-) rename packages/{ruleset-bundler/src/plugins => cli/src/services/linter/utils}/commonjs.ts (100%) diff --git a/karma.conf.ts b/karma.conf.ts index 1f04c4589..e10ca3395 100644 --- a/karma.conf.ts +++ b/karma.conf.ts @@ -24,7 +24,6 @@ module.exports = (config: Config): void => { 'packages/formatters/src/github-actions.ts', 'packages/formatters/src/sarif.ts', 'packages/formatters/src/index.node.ts', - 'packages/ruleset-bundler/src/plugins/commonjs.ts', '**/*.jest.test.ts', ], diff --git a/packages/cli/package.json b/packages/cli/package.json index d99f3305a..aebcdec73 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -34,6 +34,7 @@ "cli:debug": "node -r ts-node/register/transpile-only -r tsconfig-paths/register --inspect-brk src/index.ts" }, "dependencies": { + "@rollup/plugin-commonjs": "^25.0.0", "@stoplight/json": "~3.21.0", "@stoplight/path": "1.3.2", "@stoplight/spectral-core": "^1.18.3", diff --git a/packages/ruleset-bundler/src/plugins/commonjs.ts b/packages/cli/src/services/linter/utils/commonjs.ts similarity index 100% rename from packages/ruleset-bundler/src/plugins/commonjs.ts rename to packages/cli/src/services/linter/utils/commonjs.ts diff --git a/packages/cli/src/services/linter/utils/getRuleset.ts b/packages/cli/src/services/linter/utils/getRuleset.ts index 3dbfb4297..f96a8262b 100644 --- a/packages/cli/src/services/linter/utils/getRuleset.ts +++ b/packages/cli/src/services/linter/utils/getRuleset.ts @@ -8,7 +8,7 @@ import { fetch } from '@stoplight/spectral-runtime'; import { migrateRuleset, isBasicRuleset } from '@stoplight/spectral-ruleset-migrator'; import { bundleRuleset } from '@stoplight/spectral-ruleset-bundler'; import { node } from '@stoplight/spectral-ruleset-bundler/presets/node'; -import { commonjs } from '@stoplight/spectral-ruleset-bundler/plugins/commonjs'; +import { commonjs } from './commonjs'; import { stdin } from '@stoplight/spectral-ruleset-bundler/plugins/stdin'; import { builtins } from '@stoplight/spectral-ruleset-bundler/plugins/builtins'; import { isError, isObject } from 'lodash'; diff --git a/packages/ruleset-bundler/package.json b/packages/ruleset-bundler/package.json index 2bbc0bee6..688be4646 100644 --- a/packages/ruleset-bundler/package.json +++ b/packages/ruleset-bundler/package.json @@ -35,6 +35,7 @@ "url": "https://github.com/stoplightio/spectral.git" }, "dependencies": { + "@rollup/plugin-commonjs": "^25.0.0", "@stoplight/path": "1.3.2", "@stoplight/spectral-core": ">=1", "@stoplight/spectral-formats": ">=1", @@ -52,7 +53,7 @@ "validate-npm-package-name": "3.0.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "~22.0.2", + "@stoplight/spectral-cli": "workspace:^", "@types/validate-npm-package-name": "^3.0.3", "fetch-mock": "^9.11.0", "memfs": "^3.3.0", diff --git a/packages/ruleset-bundler/src/__tests__/index.jest.test.ts b/packages/ruleset-bundler/src/__tests__/index.jest.test.ts index c984257d1..9e13d9dba 100644 --- a/packages/ruleset-bundler/src/__tests__/index.jest.test.ts +++ b/packages/ruleset-bundler/src/__tests__/index.jest.test.ts @@ -5,7 +5,7 @@ import { bundleRuleset } from '../index'; import { IO } from '../types'; import { node } from '../presets/node'; import { browser } from '../presets/browser'; -import { commonjs } from '../plugins/commonjs'; +import { commonjs } from '@stoplight/spectral-cli/src/services/linter/utils/commonjs'; import { virtualFs } from '../plugins/virtualFs'; import { runtime } from '../presets/runtime'; import { builtins } from '../plugins/builtins'; diff --git a/yarn.lock b/yarn.lock index fa4994ff5..f7fbc5095 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1810,7 +1810,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14": +"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.15": version: 1.4.15 resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" checksum: b881c7e503db3fc7f3c1f35a1dd2655a188cc51a3612d76efc8a6eb74728bef5606e6758ee77423e564092b4a518aba569bbb21c9bac5ab7a35b0c6ae7e344c8 @@ -2387,33 +2387,38 @@ __metadata: languageName: node linkType: hard -"@rollup/plugin-commonjs@npm:~22.0.2": - version: 22.0.2 - resolution: "@rollup/plugin-commonjs@npm:22.0.2" +"@rollup/plugin-commonjs@npm:^25.0.0": + version: 25.0.7 + resolution: "@rollup/plugin-commonjs@npm:25.0.7" dependencies: - "@rollup/pluginutils": ^3.1.0 + "@rollup/pluginutils": ^5.0.1 commondir: ^1.0.1 - estree-walker: ^2.0.1 - glob: ^7.1.6 - is-reference: ^1.2.1 - magic-string: ^0.25.7 - resolve: ^1.17.0 + estree-walker: ^2.0.2 + glob: ^8.0.3 + is-reference: 1.2.1 + magic-string: ^0.30.3 peerDependencies: - rollup: ^2.68.0 - checksum: 70098a4b91afe3f164f5d27cba65edf148c5ed146ee0e07a964b66940681553ac77391083114cdcf9427e7f2706bf0d61eab310b3a2caeab83b7452c0292fcae + rollup: ^2.68.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + checksum: 052e11839a9edc556eda5dcc759ab816dcc57e9f0f905a1e6e14fff954eaa6b1e2d0d544f5bd18d863993c5eba43d8ac9c19d9bb53b1c3b1213f32cfc9d50b2e languageName: node linkType: hard -"@rollup/pluginutils@npm:^3.1.0": - version: 3.1.0 - resolution: "@rollup/pluginutils@npm:3.1.0" +"@rollup/pluginutils@npm:^5.0.1": + version: 5.1.0 + resolution: "@rollup/pluginutils@npm:5.1.0" dependencies: - "@types/estree": 0.0.39 - estree-walker: ^1.0.1 - picomatch: ^2.2.2 + "@types/estree": ^1.0.0 + estree-walker: ^2.0.2 + picomatch: ^2.3.1 peerDependencies: - rollup: ^1.20.0||^2.0.0 - checksum: 8be16e27863c219edbb25a4e6ec2fe0e1e451d9e917b6a43cf2ae5bc025a6b8faaa40f82a6e53b66d0de37b58ff472c6c3d57a83037ae635041f8df959d6d9aa + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + checksum: 3cc5a6d91452a6eabbfd1ae79b4dd1f1e809d2eecda6e175deb784e75b0911f47e9ecce73f8dd315d6a8b3f362582c91d3c0f66908b6ced69345b3cbe28f8ce8 languageName: node linkType: hard @@ -2652,10 +2657,11 @@ __metadata: languageName: node linkType: hard -"@stoplight/spectral-cli@workspace:packages/cli": +"@stoplight/spectral-cli@workspace:^, @stoplight/spectral-cli@workspace:packages/cli": version: 0.0.0-use.local resolution: "@stoplight/spectral-cli@workspace:packages/cli" dependencies: + "@rollup/plugin-commonjs": ^25.0.0 "@stoplight/json": ~3.21.0 "@stoplight/path": 1.3.2 "@stoplight/spectral-core": ^1.18.3 @@ -2802,8 +2808,9 @@ __metadata: version: 0.0.0-use.local resolution: "@stoplight/spectral-ruleset-bundler@workspace:packages/ruleset-bundler" dependencies: - "@rollup/plugin-commonjs": ~22.0.2 + "@rollup/plugin-commonjs": ^25.0.0 "@stoplight/path": 1.3.2 + "@stoplight/spectral-cli": "workspace:^" "@stoplight/spectral-core": ">=1" "@stoplight/spectral-formats": ">=1" "@stoplight/spectral-functions": ">=1" @@ -3192,10 +3199,10 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:0.0.39": - version: 0.0.39 - resolution: "@types/estree@npm:0.0.39" - checksum: 412fb5b9868f2c418126451821833414189b75cc6bf84361156feed733e3d92ec220b9d74a89e52722e03d5e241b2932732711b7497374a404fad49087adc248 +"@types/estree@npm:^1.0.0": + version: 1.0.5 + resolution: "@types/estree@npm:1.0.5" + checksum: dd8b5bed28e6213b7acd0fb665a84e693554d850b0df423ac8076cc3ad5823a6bc26b0251d080bdc545af83179ede51dd3f6fa78cad2c46ed1f29624ddf3e41a languageName: node linkType: hard @@ -6104,14 +6111,7 @@ __metadata: languageName: node linkType: hard -"estree-walker@npm:^1.0.1": - version: 1.0.1 - resolution: "estree-walker@npm:1.0.1" - checksum: 7e70da539691f6db03a08e7ce94f394ce2eef4180e136d251af299d41f92fb2d28ebcd9a6e393e3728d7970aeb5358705ddf7209d52fbcb2dd4693f95dcf925f - languageName: node - linkType: hard - -"estree-walker@npm:^2.0.1": +"estree-walker@npm:^2.0.2": version: 2.0.2 resolution: "estree-walker@npm:2.0.2" checksum: 6151e6f9828abe2259e57f5fd3761335bb0d2ebd76dc1a01048ccee22fabcfef3c0859300f6d83ff0d1927849368775ec5a6d265dde2f6de5a1be1721cd94efc @@ -6826,6 +6826,19 @@ __metadata: languageName: node linkType: hard +"glob@npm:^8.0.3": + version: 8.1.0 + resolution: "glob@npm:8.1.0" + dependencies: + fs.realpath: ^1.0.0 + inflight: ^1.0.4 + inherits: 2 + minimatch: ^5.0.1 + once: ^1.3.0 + checksum: 92fbea3221a7d12075f26f0227abac435de868dd0736a17170663783296d0dd8d3d532a5672b4488a439bf5d7fb85cdd07c11185d6cd39184f0385cbdfb86a47 + languageName: node + linkType: hard + "global-dirs@npm:^0.1.1": version: 0.1.1 resolution: "global-dirs@npm:0.1.1" @@ -7613,7 +7626,7 @@ __metadata: languageName: node linkType: hard -"is-reference@npm:^1.2.1": +"is-reference@npm:1.2.1": version: 1.2.1 resolution: "is-reference@npm:1.2.1" dependencies: @@ -9095,6 +9108,15 @@ __metadata: languageName: node linkType: hard +"magic-string@npm:^0.30.3": + version: 0.30.5 + resolution: "magic-string@npm:0.30.5" + dependencies: + "@jridgewell/sourcemap-codec": ^1.4.15 + checksum: da10fecff0c0a7d3faf756913ce62bd6d5e7b0402be48c3b27bfd651b90e29677e279069a63b764bcdc1b8ecdcdb898f29a5c5ec510f2323e8d62ee057a6eb18 + languageName: node + linkType: hard + "make-dir@npm:^3.0.0": version: 3.0.2 resolution: "make-dir@npm:3.0.2" @@ -10640,13 +10662,20 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.2, picomatch@npm:^2.2.3": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3": version: 2.3.0 resolution: "picomatch@npm:2.3.0" checksum: 16818720ea7c5872b6af110760dee856c8e4cd79aed1c7a006d076b1cc09eff3ae41ca5019966694c33fbd2e1cc6ea617ab10e4adac6df06556168f13be3fca2 languageName: node linkType: hard +"picomatch@npm:^2.3.1": + version: 2.3.1 + resolution: "picomatch@npm:2.3.1" + checksum: 050c865ce81119c4822c45d3c84f1ced46f93a0126febae20737bd05ca20589c564d6e9226977df859ed5e03dc73f02584a2b0faad36e896936238238b0446cf + languageName: node + linkType: hard + "pify@npm:^3.0.0": version: 3.0.0 resolution: "pify@npm:3.0.0"