From 0c7b41f608384ea79e31186eb35a70bc171d641b Mon Sep 17 00:00:00 2001 From: Rahim Alwer Date: Wed, 4 Aug 2021 15:18:39 +1000 Subject: [PATCH] Revert "Avoid creating new node processes by leveraging processAsync (#57)" This reverts commit 2383320fe022a3ea78741507ee400bca9bee5859. --- README.md | 30 +- jest.config.js | 7 +- package-lock.json | 650 ++++++++++++------ package.json | 18 +- .../fixtures/shared/commonTransformerTests.js | 77 +++ src/__tests__/transformer.test.cjs | 26 + src/__tests__/transformer.test.js | 101 +-- src/preprocess.js | 21 + src/transformer.cjs | 55 ++ src/transformer.js | 51 -- 10 files changed, 670 insertions(+), 366 deletions(-) create mode 100644 src/__tests__/fixtures/shared/commonTransformerTests.js create mode 100644 src/__tests__/transformer.test.cjs create mode 100644 src/preprocess.js create mode 100644 src/transformer.cjs delete mode 100644 src/transformer.js diff --git a/README.md b/README.md index ea28281..19a6f4c 100644 --- a/README.md +++ b/README.md @@ -150,21 +150,24 @@ Add the following to your Jest config ```json "transform": { + "^.+\\.js$": "babel-jest", "^.+\\.svelte$": ["svelte-jester", { "preprocess": true }] } ``` -Create a `svelte.config.js` file and configure it, see +Create a `svelte.config.js` file and configure it, see [svelte-preprocess](https://github.com/kaisermann/svelte-preprocess) for more information. ## Options -`preprocess` (default: false): Pass in `true` if you are using Svelte preprocessors. +`preprocess` (default: false): Pass in `true` if you are using Svelte preprocessors. They are loaded from `svelte.config.js` or `svelte.config.cjs`. +`showConsoleLog` (default: false): If you'd like to see console.logs of the preprocessors then pass in `true`. Otherwise these will be surpressed, because the compiler could complain about unexpected tokens. + `debug` (default: false): If you'd like to see the output of the compiled code then pass in `true`. -`compilerOptions` (default: {}): Use this to pass in +`compilerOptions` (default: {}): Use this to pass in [Svelte compiler options](https://svelte.dev/docs#svelte_compile). `rootMode` (default: ""): Pass in `upward` to walk up from the transforming file's directory and use the first `svelte.config.js` or `svelte.config.cjs` found, or throw an error if no config file is discovered. This is particularly useful in a monorepo as it allows you to: @@ -176,11 +179,26 @@ The default mode is to load `svelte.config.js` or `svelte.config.cjs` from the c When `upward` is set it will stop at the first config file it finds above the file being transformed, but will walk up the directory structure all the way to the filesystem root if it cannot find any config file. This means that if there is no `svelte.config.js` or `svelte.config.cjs` file in the project above the file being transformed, it is always possible that someone will have a forgotten config file in their home directory which could cause unexpected errors in your builds. +`maxBuffer` (default: 10485760): Sets limit for buffer when `preprocess` is true. It defines the largest amount of data in bytes allowed on stdout or stderr for [child_process.spawnSync](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options). If exceeded, the child process is terminated and any output is truncated. The default value of 10Mb overrides Node's default value of 1Mb. + +```json +"transform": { + "^.+\\.js$": "babel-jest", + "^.+\\.svelte$": ["svelte-jester", { + "preprocess": false, + "debug": false, + "compilerOptions": {}, + "rootMode": "", + "maxBuffer": 15000000 + }] +} +``` + ## Testing Library -This package is required when using Svelte with the [Testing Library](https://testing-library.com/). -If you'd like to avoid including implementation details in your tests, and making them more -maintainble in the long run, then consider checking out +This package is required when using Svelte with the [Testing Library](https://testing-library.com/). +If you'd like to avoid including implementation details in your tests, and making them more +maintainble in the long run, then consider checking out [@testing-library/svelte](https://github.com/testing-library/svelte-testing-library). ## Credits diff --git a/jest.config.js b/jest.config.js index bad9c69..d988105 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,12 +8,15 @@ export default { moduleFileExtensions: ['js', 'ts', 'cjs'], testMatch: [ - '**/?(*.)+(spec|test).?(c)[tj]s?(x)' + '**/__tests__/**/*.?(c)[jt]s?(x)', + '**/?(*.)+(spec|test).?(c)[tj]s?(x)', + '!**/fixtures/**' ], testRunner: 'jest-circus/runner', transform: { - '^.+\\.ts$': 'esbuild-jest' + '^.+\\.ts$': 'esbuild-jest', + '^.+\\.js$': 'esbuild-jest' } } diff --git a/package-lock.json b/package-lock.json index de1ec8e..71ae9be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,8 @@ "devDependencies": { "@sveltejs/adapter-static": "^1.0.0-next.10", "@types/jest": "^26.0.0", - "cross-env": "^7.0.3", - "doctoc": "^2.0.0", - "esbuild": "^0.12.0", + "doctoc": "^2.0.1", + "esbuild": "^0.12.8", "esbuild-jest": "^0.5.0", "jest": "^27.0.0", "jest-circus": "^27.0.0", @@ -21,7 +20,8 @@ "standard-version": "^9.3.0", "svelte": "^3.0.0", "svelte-preprocess": "^4.0.0", - "typescript": "^4.0.0" + "typescript": "^4.0.0", + "why-is-node-running": "^2.2.0" }, "engines": { "node": ">= 14" @@ -82,6 +82,29 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/@babel/generator": { "version": "7.14.9", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.9.tgz", @@ -527,6 +550,29 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/traverse/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/traverse/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/@babel/types": { "version": "7.14.9", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.9.tgz", @@ -583,6 +629,23 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -598,6 +661,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/@eslint/eslintrc/node_modules/type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", @@ -2146,6 +2215,29 @@ "unified": "^6.1.6" } }, + "node_modules/@textlint/markdown-to-ast/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@textlint/markdown-to-ast/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -2381,6 +2473,29 @@ "node": ">= 6.0.0" } }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -3989,24 +4104,6 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "node_modules/cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "bin": { - "cross-env": "src/bin/cross-env.js", - "cross-env-shell": "src/bin/cross-env-shell.js" - }, - "engines": { - "node": ">=10.14", - "npm": ">=6", - "yarn": ">=1" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -4090,20 +4187,12 @@ } }, "node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "ms": "2.0.0" } }, "node_modules/decamelize": { @@ -4765,21 +4854,6 @@ "resolve": "^1.13.1" } }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/eslint-import-resolver-node/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/eslint-module-utils": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz", @@ -4827,6 +4901,12 @@ "node": ">=4" } }, + "node_modules/eslint-module-utils/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, "node_modules/eslint-module-utils/node_modules/p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -4927,15 +5007,6 @@ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" } }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, "node_modules/eslint-plugin-import/node_modules/doctrine": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", @@ -4995,12 +5066,6 @@ "node": ">=4" } }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/eslint-plugin-import/node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -5312,6 +5377,23 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/eslint/node_modules/globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -5349,6 +5431,12 @@ "node": ">= 0.8.0" } }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/eslint/node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -5569,15 +5657,6 @@ "node": ">=0.10.0" } }, - "node_modules/expand-brackets/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, "node_modules/expand-brackets/node_modules/define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -5682,12 +5761,6 @@ "node": ">=0.10.0" } }, - "node_modules/expand-brackets/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/expect": { "version": "27.0.6", "resolved": "https://registry.npmjs.org/expect/-/expect-27.0.6.tgz", @@ -6108,20 +6181,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -6820,6 +6879,29 @@ "node": ">= 6" } }, + "node_modules/http-proxy-agent/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/http-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -6848,6 +6930,29 @@ "node": ">= 6" } }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -7464,6 +7569,29 @@ "node": ">=8" } }, + "node_modules/istanbul-lib-source-maps/node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/istanbul-lib-source-maps/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -11618,9 +11746,9 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "node_modules/nan": { @@ -13308,9 +13436,6 @@ "lodash": "^4.0.0", "scss-tokenizer": "^0.2.3", "yargs": "^13.3.2" - }, - "bin": { - "sassgraph": "bin/sassgraph" } }, "node_modules/sass-graph/node_modules/ansi-regex": { @@ -13588,6 +13713,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -13701,15 +13832,6 @@ "node": ">=0.10.0" } }, - "node_modules/snapdragon/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, "node_modules/snapdragon/node_modules/define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -13814,12 +13936,6 @@ "node": ">=0.10.0" } }, - "node_modules/snapdragon/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -13968,11 +14084,6 @@ "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, "engines": { "node": ">=0.10.0" } @@ -13998,6 +14109,12 @@ "node": ">=8" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha1-Gsig2Ug4SNFpXkGLbQMaPDzmjjs=", + "dev": true + }, "node_modules/standard": { "version": "16.0.3", "resolved": "https://registry.npmjs.org/standard/-/standard-16.0.3.tgz", @@ -14666,9 +14783,9 @@ } }, "node_modules/tar": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.3.tgz", - "integrity": "sha512-3rUqwucgVZXTeyJyL2jqtUau8/8r54SioM1xj3AmTX3HnWQdj2AydfJ2qYYayPyIIznSplcvU9mhBb7dR2XF3w==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.2.tgz", + "integrity": "sha512-EwKEgqJ7nJoS+s8QfLYVGMDmAsj+StbI2AM/RTHeUSsOw6Z8bwNBRv5z3CY0m7laC5qUAqruLX5AhMuc5deY3Q==", "dev": true, "dependencies": { "chownr": "^2.0.0", @@ -15434,6 +15551,22 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "node_modules/why-is-node-running": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.0.tgz", + "integrity": "sha512-rxtN9D0lJaYyP92BR5yoyWecK2txBKmBIuS7GRbOPP5bXsT37/hBqcmTrlrt25DBr9p4WJb6c9LuYSJd89vHRQ==", + "dev": true, + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -15757,6 +15890,23 @@ "json5": "^2.1.2", "semver": "^6.3.0", "source-map": "^0.5.0" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@babel/generator": { @@ -16085,6 +16235,23 @@ "@babel/types": "^7.14.9", "debug": "^4.1.0", "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@babel/types": { @@ -16131,6 +16298,15 @@ "strip-json-comments": "^3.1.1" }, "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -16140,6 +16316,12 @@ "type-fest": "^0.8.1" } }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", @@ -17346,6 +17528,23 @@ "structured-source": "^3.0.2", "traverse": "^0.6.6", "unified": "^6.1.6" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "@tootallnate/once": { @@ -17560,6 +17759,23 @@ "dev": true, "requires": { "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "ajv": { @@ -18813,15 +19029,6 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.1" - } - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -18889,12 +19096,12 @@ "dev": true }, "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { - "ms": "2.1.2" + "ms": "2.0.0" } }, "decamelize": { @@ -19387,6 +19594,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "globals": { "version": "12.4.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", @@ -19412,6 +19628,12 @@ "type-check": "~0.4.0" } }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -19489,23 +19711,6 @@ "requires": { "debug": "^2.6.9", "resolve": "^1.13.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "eslint-module-utils": { @@ -19546,6 +19751,12 @@ "path-exists": "^3.0.0" } }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -19618,15 +19829,6 @@ "tsconfig-paths": "^3.9.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "doctrine": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", @@ -19674,12 +19876,6 @@ "path-exists": "^3.0.0" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -19985,15 +20181,6 @@ "to-regex": "^3.0.1" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -20074,12 +20261,6 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, @@ -20411,13 +20592,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -20953,6 +21127,23 @@ "@tootallnate/once": "1", "agent-base": "6", "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "http-signature": { @@ -20974,6 +21165,23 @@ "requires": { "agent-base": "6", "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, "human-signals": { @@ -21413,6 +21621,21 @@ "source-map": "^0.6.1" }, "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -24604,9 +24827,9 @@ "dev": true }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "nan": { @@ -26153,6 +26376,12 @@ "object-inspect": "^1.9.0" } }, + "siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -26206,15 +26435,6 @@ "use": "^3.1.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "define-property": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", @@ -26295,12 +26515,6 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true } } }, @@ -26501,6 +26715,12 @@ } } }, + "stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha1-Gsig2Ug4SNFpXkGLbQMaPDzmjjs=", + "dev": true + }, "standard": { "version": "16.0.3", "resolved": "https://registry.npmjs.org/standard/-/standard-16.0.3.tgz", @@ -26954,9 +27174,9 @@ } }, "tar": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.3.tgz", - "integrity": "sha512-3rUqwucgVZXTeyJyL2jqtUau8/8r54SioM1xj3AmTX3HnWQdj2AydfJ2qYYayPyIIznSplcvU9mhBb7dR2XF3w==", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.2.tgz", + "integrity": "sha512-EwKEgqJ7nJoS+s8QfLYVGMDmAsj+StbI2AM/RTHeUSsOw6Z8bwNBRv5z3CY0m7laC5qUAqruLX5AhMuc5deY3Q==", "dev": true, "requires": { "chownr": "^2.0.0", @@ -27581,6 +27801,16 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "why-is-node-running": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.0.tgz", + "integrity": "sha512-rxtN9D0lJaYyP92BR5yoyWecK2txBKmBIuS7GRbOPP5bXsT37/hBqcmTrlrt25DBr9p4WJb6c9LuYSJd89vHRQ==", + "dev": true, + "requires": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + } + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", diff --git a/package.json b/package.json index ea5b7fb..9a623a6 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,7 @@ "name": "svelte-jester", "version": "1.8.0", "description": "A Jest transformer for Svelte - compile your components before importing them into tests", - "main": "src/transformer.js", - "exports": { - "import": "./src/transformer.js" - }, + "main": "src/transformer.cjs", "type": "module", "license": "MIT", "author": "Rahim Alwer ", @@ -31,13 +28,14 @@ "test" ], "files": [ - "src/transformer.js", + "src/transformer.cjs", + "src/preprocess.js", "src/svelteconfig.cjs" ], "scripts": { "toc": "doctoc README.md", "lint": "standard --fix --env jest", - "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest src", + "test": "jest src", "test:watch": "yarn test --watch", "test:update": "yarn test --updateSnapshot --coverage", "setup": "yarn && yarn validate", @@ -51,9 +49,8 @@ "devDependencies": { "@sveltejs/adapter-static": "^1.0.0-next.10", "@types/jest": "^26.0.0", - "cross-env": "^7.0.3", - "doctoc": "^2.0.0", - "esbuild": "^0.12.0", + "doctoc": "^2.0.1", + "esbuild": "^0.12.8", "esbuild-jest": "^0.5.0", "jest": "^27.0.0", "jest-circus": "^27.0.0", @@ -62,6 +59,7 @@ "standard-version": "^9.3.0", "svelte": "^3.0.0", "svelte-preprocess": "^4.0.0", - "typescript": "^4.0.0" + "typescript": "^4.0.0", + "why-is-node-running": "^2.2.0" } } diff --git a/src/__tests__/fixtures/shared/commonTransformerTests.js b/src/__tests__/fixtures/shared/commonTransformerTests.js new file mode 100644 index 0000000..baa3b02 --- /dev/null +++ b/src/__tests__/fixtures/shared/commonTransformerTests.js @@ -0,0 +1,77 @@ +const sharedTests = (dependencies) => { + const { path, runTransformer } = dependencies + + it('should transform basic component', () => { + runTransformer('BasicComp') + }) + + it('should transform when using sass preprocessor', () => { + runTransformer('SassComp', { preprocess: true }) + }) + + it('should transform when using full path to preprocess', () => { + const preprocessPath = path.resolve(__dirname, '../../../../_svelte.config.cjs') + runTransformer('SassComp', { preprocess: preprocessPath }) + }) + + it('should search for "svelte.config.cjs" as well as "svelte.config.js"', () => { + const results = runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) + // this is a little brittle, but it demonstrates that the replacements in + // "svelte.config.cjs" are working + expect(results).toContain('text("Bye ");') + }) + + it('should transform when using typescript preprocessor', () => { + runTransformer('TypescriptComp', { preprocess: true }) + }) + + it('should transform basic component and keep styles', () => { + const code = runTransformer('BasicComp') + expect(code).toContain('add_css()') + expect(code).toContain('.counter.active') + }) + + it('should accept compiler options', () => { + const code = runTransformer('BasicComp', { compilerOptions: { css: false } }) + expect(code).not.toContain('add_css()') + expect(code).not.toContain('.counter.active') + }) + + it('should output code to console when debug is true', () => { + global.window.console.log = jest.fn() + const code = runTransformer('BasicComp', { debug: true }) + const esInterop = 'Object.defineProperty(exports, "__esModule", { value: true });' + expect(global.window.console.log).toHaveBeenCalledWith(code.replace(esInterop, '')) + }) + + it('should accept maxBuffer option for preprocess buffer limit', () => { + expect( + () => runTransformer('SassComp', { preprocess: true, maxBuffer: 1 }) + ).toThrow(/^spawnSync .* ENOBUFS$/) + runTransformer('SassComp', { preprocess: true, maxBuffer: 5 * 1024 * 1024 }) + }) + + it('should fail, if console.logs are enabled during preprocessing and there is a console.log statement in the svelte config', () => { + expect( + () => runTransformer('BasicComp', { preprocess: true, rootMode: 'upward', showConsoleLog: true }) + ).toThrow(/^Unexpected token T in JSON at position 0$/) + }) + + it('should pass, if console.logs are disabled (default) during preprocessing and there is a console.log statement in the svelte config', () => { + runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) + }) + + it.only('should pass, if console.logs are disabled during preprocessing and there is a console.log statement in the svelte config', () => { + runTransformer('BasicComp', { preprocess: true, rootMode: 'upward', showConsoleLog: false }) + runTransformer('BasicComp', { preprocess: true, rootMode: 'upward', showConsoleLog: "false" }) + }) + + it('should pass and transform process.env.NODE_ENV variable', () => { + const code = runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) + + // JEST sets NODE_ENV to test automatically + expect(code).toContain('test') + }) +} + +export default sharedTests diff --git a/src/__tests__/transformer.test.cjs b/src/__tests__/transformer.test.cjs new file mode 100644 index 0000000..32952c4 --- /dev/null +++ b/src/__tests__/transformer.test.cjs @@ -0,0 +1,26 @@ +const fs = require('fs') +const path = require('path') +const transformer = require('../transformer') +const sharedTests = require('./fixtures/shared/commonTransformerTests').default + +const runTransformer = (filename, options) => { + const process = transformer.createTransformer(options).process + const path = require.resolve(`./fixtures/${filename}.svelte`) + const source = fs.readFileSync(path).toString() + const result = process(source, path) + expect(result.code).toBeDefined() + expect(result.code).toContain('SvelteComponent') + expect(result.map).toBeDefined() + return result.code +} + +describe('CJS transformer', () => { + it('should search for "svelte.config.cjs" as well as "svelte.config.js"', () => { + const results = runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) + // this is a little brittle, but it demonstrates that the replacements in + // "svelte.config.cjs" are working + expect(results).toContain('text("Bye ");') + }) + + sharedTests({ runTransformer, path }) +}) diff --git a/src/__tests__/transformer.test.js b/src/__tests__/transformer.test.js index a501b31..b968115 100644 --- a/src/__tests__/transformer.test.js +++ b/src/__tests__/transformer.test.js @@ -1,21 +1,13 @@ -/** - * @jest-environment jsdom - */ -import { readFileSync } from 'fs' -import { dirname } from 'path' -import { fileURLToPath } from 'url' -import { jest } from '@jest/globals' - -import createTransformer from '../transformer' - -// Node API __dirname is missing in ESM -export const __dirname = dirname(fileURLToPath(import.meta.url)) - -const runTransformer = async (filename, options) => { - const processAsync = createTransformer(options).processAsync - const path = `${__dirname}/fixtures/${filename}.svelte` - const source = readFileSync(path).toString() - const result = await processAsync(source, path) +import fs from 'fs' +import path from 'path' +import transformer from '../transformer' +import sharedTests from './fixtures/shared/commonTransformerTests' + +const runTransformer = (filename, options) => { + const process = transformer.createTransformer(options).process + const path = require.resolve(`./fixtures/${filename}.svelte`) + const source = fs.readFileSync(path).toString() + const result = process(source, path) expect(result.code).toBeDefined() expect(result.code).toContain('SvelteComponent') expect(result.map).toBeDefined() @@ -23,78 +15,13 @@ const runTransformer = async (filename, options) => { } describe('ESM transformer', () => { - it('should transform with config in ESM format', async () => { - const svelteKitConfigPath = `${__dirname}/fixtures/sveltekit.config.js` - const results = await runTransformer('BasicComp', { preprocess: svelteKitConfigPath }) + it('should transform with config in ESM format', () => { + const svelteKitConfig = path.resolve(__dirname, './fixtures/sveltekit.config.js') + const results = runTransformer('BasicComp', { preprocess: svelteKitConfig }) // this is a little brittle, but it demonstrates that the replacements in // "sveltekit.config.js" are working expect(results).toContain('text("Bye ");') }) - it('should search for "svelte.config.cjs" as well as "svelte.config.js"', async () => { - const results = await runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) - // this is a little brittle, but it demonstrates that the replacements in - // "svelte.config.cjs" are working - expect(results).toContain('text("Bye ");') - }) - - it('should transform basic component', async () => { - await runTransformer('BasicComp') - }) - - it('should transform when using sass preprocessor', async () => { - await runTransformer('SassComp', { preprocess: true }) - }) - - it('should transform when using full path to preprocess', async () => { - const preprocessPath = `${__dirname}/../../_svelte.config.cjs` - await runTransformer('SassComp', { preprocess: preprocessPath }) - }) - - it('should search for "svelte.config.cjs" as well as "svelte.config.js"', async () => { - const results = await runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) - // this is a little brittle, but it demonstrates that the replacements in - // "svelte.config.cjs" are working - expect(results).toContain('text("Bye ");') - }) - - it('should transform when using typescript preprocessor', async () => { - await runTransformer('TypescriptComp', { preprocess: true }) - }) - - it('should transform basic component and keep styles', async () => { - const code = await runTransformer('BasicComp') - expect(code).toContain('add_css(target)') - expect(code).toContain('.counter.active') - }) - - it('should accept compiler options', async () => { - const code = await runTransformer('BasicComp', { compilerOptions: { css: false } }) - expect(code).not.toContain('add_css(target)') - expect(code).not.toContain('.counter.active') - }) - - it('should output code to console when debug is true', async () => { - console.log = jest.fn() - const code = await runTransformer('BasicComp', { debug: true }) - const esInterop = 'Object.defineProperty(exports, "__esModule", { value: true });' - expect(console.log).toHaveBeenCalledTimes(1) - expect(console.log).toHaveBeenCalledWith(code.replace(esInterop, '')) - }) - - it('should pass, if console.logs are disabled (default) during preprocessing and there is a console.log statement in the svelte config', async () => { - await runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) - }) - - it('should pass, if console.logs are disabled during preprocessing and there is a console.log statement in the svelte config', async () => { - await runTransformer('BasicComp', { preprocess: true, rootMode: 'upward', showConsoleLog: false }) - await runTransformer('BasicComp', { preprocess: true, rootMode: 'upward', showConsoleLog: 'false' }) - }) - - it('should pass and transform process.env.NODE_ENV variable', async () => { - const code = await runTransformer('BasicComp', { preprocess: true, rootMode: 'upward' }) - - // JEST sets NODE_ENV to test automatically - expect(code).toContain('test') - }) + sharedTests({ runTransformer, path }) }) diff --git a/src/preprocess.js b/src/preprocess.js new file mode 100644 index 0000000..3449650 --- /dev/null +++ b/src/preprocess.js @@ -0,0 +1,21 @@ +import { preprocess } from 'svelte/compiler' +import { pathToFileURL } from 'url' + +const { source, filename, svelteConfig, showConsoleLog } = process.env + +// convert option string to boolean +const showConsoleLogOption = showConsoleLog && showConsoleLog.toLowerCase() === 'true' + +// redefine console.log to hide its output, so it does not interfere with the svelte-compiler +if (!showConsoleLogOption && console) { + console.log = console.error = console.info = console.debug = console.warn = console.trace = console.dir = console.dirxml = console.group = console.groupEnd = console.time = console.timeEnd = console.assert = console.profile = () => {} +} + +import(pathToFileURL(svelteConfig)).then(configImport => { + // ESM or CommonJS + const config = configImport.default ? configImport.default : configImport + + preprocess(source, config.preprocess || {}, { filename }).then((r) => { + process.stdout.write(JSON.stringify(r)) + }) +}).catch(err => process.stderr.write(err)) diff --git a/src/transformer.cjs b/src/transformer.cjs new file mode 100644 index 0000000..928c6a8 --- /dev/null +++ b/src/transformer.cjs @@ -0,0 +1,55 @@ +// const log = require('why-is-node-running') +const { basename } = require('path') +const { execSync } = require('child_process') +const svelte = require('svelte/compiler') +const { getSvelteConfig } = require('./svelteconfig.cjs') + +const transformer = (options = {}) => (source, filename) => { + const { preprocess, rootMode, maxBuffer, showConsoleLog } = options + if (!preprocess) { + return compiler(options, filename, source) + } + + const svelteConfig = getSvelteConfig(rootMode, filename, preprocess) + const preprocessor = require.resolve('./preprocess.js') + + const preprocessResult = execSync( + `node --unhandled-rejections=strict --abort-on-uncaught-exception ${preprocessor}`, + { + env: { ...process.env, source, filename, svelteConfig, showConsoleLog }, + maxBuffer: maxBuffer || 10 * 1024 * 1024 + } + ).toString() + + const parsedPreprocessResult = JSON.parse(preprocessResult) + return compiler(options, filename, parsedPreprocessResult.code, parsedPreprocessResult.map) +} + +const compiler = (options = {}, filename, processedCode, processedMap) => { + const { debug, compilerOptions } = options + + const result = svelte.compile(processedCode, { + filename: basename(filename), + css: true, + accessors: true, + dev: true, + format: 'cjs', + sourcemap: processedMap, + ...compilerOptions + }) + + if (debug) { + console.log(result.js.code) + } + + const esInterop = 'Object.defineProperty(exports, "__esModule", { value: true });' + + return { + code: result.js.code + esInterop, + map: JSON.stringify(result.js.map) + } +} + +exports.createTransformer = (options) => ({ + process: transformer(options) +}) diff --git a/src/transformer.js b/src/transformer.js deleted file mode 100644 index 885436c..0000000 --- a/src/transformer.js +++ /dev/null @@ -1,51 +0,0 @@ -import { basename } from 'path' -import { pathToFileURL } from 'url' -import svelte from 'svelte/compiler' - -import { getSvelteConfig } from './svelteconfig' - -const dynamicImport = async (filename) => import(pathToFileURL(filename)) - -const transformer = (options = {}) => async (source, filename) => { - const { preprocess, rootMode } = options - if (!preprocess) { - return compiler(options, filename, source) - } - - const svelteConfigPath = getSvelteConfig(rootMode, filename, preprocess) - const svelteConfig = await dynamicImport(svelteConfigPath) - const processed = await svelte.preprocess(source, svelteConfig.default.preprocess || {}, { filename }) - - return compiler(options, filename, processed.code, processed.map) -} - -const compiler = (options = {}, filename, processedCode, processedMap) => { - const { debug, compilerOptions } = options - - const result = svelte.compile(processedCode, { - filename: basename(filename), - css: true, - accessors: true, - dev: true, - format: 'esm', - sourcemap: processedMap, - ...compilerOptions - }) - - if (debug) { - console.log(result.js.code) - } - - const esInterop = 'Object.defineProperty(exports, "__esModule", { value: true });' - - return { - code: result.js.code + esInterop, - map: JSON.stringify(result.js.map) - } -} - -const createTransformer = (options) => ({ - processAsync: transformer(options) -}) - -export default createTransformer