From 91a4b807dc1e9b7ed700b6645eff711cfa1d5bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ro=C5=BCek?= Date: Fri, 4 Feb 2022 00:15:17 +0100 Subject: [PATCH] feat(ruleset-bundler): expose commonjs plugin --- __karma__/perf_hooks.js | 0 __karma__/process.js | 2 +- karma.conf.ts | 3 +- packages/ruleset-bundler/package.json | 3 +- .../ruleset-bundler/src/plugins/commonjs.ts | 1 + yarn.lock | 28 +++++++++++++++---- 6 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 __karma__/perf_hooks.js create mode 100644 packages/ruleset-bundler/src/plugins/commonjs.ts diff --git a/__karma__/perf_hooks.js b/__karma__/perf_hooks.js new file mode 100644 index 000000000..e69de29bb diff --git a/__karma__/process.js b/__karma__/process.js index f237ddf58..98594c821 100644 --- a/__karma__/process.js +++ b/__karma__/process.js @@ -1 +1 @@ -export default undefined; +export const on = Function(); diff --git a/karma.conf.ts b/karma.conf.ts index 45917c494..2581b4bb6 100644 --- a/karma.conf.ts +++ b/karma.conf.ts @@ -17,7 +17,7 @@ module.exports = (config: Config): void => { files: ['./__karma__/jest.ts', 'packages/*/src/**/*.ts'], // list of files / patterns to exclude - exclude: ['packages/cli/**', '**/*.jest.test.ts'], + exclude: ['packages/cli/**', 'packages/ruleset-bundler/src/plugins/commonjs.ts', '**/*.jest.test.ts'], // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor @@ -41,6 +41,7 @@ module.exports = (config: Config): void => { 'node-fetch': require.resolve('./__karma__/fetch'), fs: require.resolve('./__karma__/fs'), process: require.resolve('./__karma__/process'), + perf_hooks: require.resolve('./__karma__/perf_hooks'), fsevents: require.resolve('./__karma__/fsevents'), }, }, diff --git a/packages/ruleset-bundler/package.json b/packages/ruleset-bundler/package.json index 0761b7dcf..f2108a2f4 100644 --- a/packages/ruleset-bundler/package.json +++ b/packages/ruleset-bundler/package.json @@ -38,6 +38,7 @@ "release": "semantic-release -e semantic-release-monorepo" }, "dependencies": { + "@rollup/plugin-commonjs": "^21.0.1", "@stoplight/path": "1.3.2", "@stoplight/spectral-core": ">=1", "@stoplight/spectral-formats": ">=1", @@ -50,7 +51,7 @@ "@stoplight/types": "^12.3.0", "@types/node": "*", "pony-cause": "1.1.1", - "rollup": "~2.60.2", + "rollup": "~2.67.0", "tslib": "^2.3.1", "validate-npm-package-name": "3.0.0" }, diff --git a/packages/ruleset-bundler/src/plugins/commonjs.ts b/packages/ruleset-bundler/src/plugins/commonjs.ts new file mode 100644 index 000000000..19a107ba6 --- /dev/null +++ b/packages/ruleset-bundler/src/plugins/commonjs.ts @@ -0,0 +1 @@ +export { default as commonjs } from '@rollup/plugin-commonjs'; diff --git a/yarn.lock b/yarn.lock index 6191b0f50..815b0186a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2077,6 +2077,23 @@ __metadata: languageName: node linkType: hard +"@rollup/plugin-commonjs@npm:^21.0.1": + version: 21.0.1 + resolution: "@rollup/plugin-commonjs@npm:21.0.1" + dependencies: + "@rollup/pluginutils": ^3.1.0 + 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 + peerDependencies: + rollup: ^2.38.3 + checksum: 3e56be58c72d655face6f361f85923ddcc3cc07760b5a3a91cfc728115dfed358fc595781148c512d53a03be8c703133379f228e78fd2aed8655fae9d83800b6 + languageName: node + linkType: hard + "@rollup/pluginutils@npm:^3.1.0": version: 3.1.0 resolution: "@rollup/pluginutils@npm:3.1.0" @@ -2449,6 +2466,7 @@ __metadata: version: 0.0.0-use.local resolution: "@stoplight/spectral-ruleset-bundler@workspace:packages/ruleset-bundler" dependencies: + "@rollup/plugin-commonjs": ^21.0.1 "@stoplight/path": 1.3.2 "@stoplight/spectral-core": ">=1" "@stoplight/spectral-formats": ">=1" @@ -2465,7 +2483,7 @@ __metadata: memfs: ^3.3.0 pony-cause: 1.1.1 prettier: ^2.4.1 - rollup: ~2.60.2 + rollup: ~2.67.0 tslib: ^2.3.1 validate-npm-package-name: 3.0.0 languageName: unknown @@ -11067,9 +11085,9 @@ __metadata: languageName: node linkType: hard -"rollup@npm:~2.60.2": - version: 2.60.2 - resolution: "rollup@npm:2.60.2" +"rollup@npm:~2.67.0": + version: 2.67.2 + resolution: "rollup@npm:2.67.2" dependencies: fsevents: ~2.3.2 dependenciesMeta: @@ -11077,7 +11095,7 @@ __metadata: optional: true bin: rollup: dist/bin/rollup - checksum: bcd41dfe8afb7e0d97ce2237752165bdda689bcce6321d96821d565de3e0c865a49b544923f315985be2bfde086f72b54aae4ae7c87f798b3cb9558a5bec4e65 + checksum: 9aca5251ba4b441064183cde2394b91567259002d68086bdd3906db66d55dd148ab27e57c51eb53830d7b9b813c2d4e834b7735d65e2a869780bc639d4a20c38 languageName: node linkType: hard