diff --git a/examples/config-babel/babel.config.json b/examples/config-babel/babel.config.json index ab1c3115..75dfc4c8 100644 --- a/examples/config-babel/babel.config.json +++ b/examples/config-babel/babel.config.json @@ -1,4 +1,4 @@ { - "presets": [], + "presets": ["modern-browser-extension"], "plugins": [] } diff --git a/examples/config-babel/extension.config.js b/examples/config-babel/extension.config.js new file mode 100644 index 00000000..3e57e763 --- /dev/null +++ b/examples/config-babel/extension.config.js @@ -0,0 +1,17 @@ +/** @type {import('extension-develop').FileConfig} */ +module.exports = { + config: (config) => { + config.module.rules.push( + // https://webpack.js.org/loaders/babel-loader/ + // https://babeljs.io/docs/en/babel-loader + { + test: /\.(js|mjs|jsx|ts|tsx)$/, + include: __dirname, + exclude: /node_modules/, + loader: require.resolve('babel-loader') + } + ) + + return config + } +} diff --git a/examples/config-babel/package.json b/examples/config-babel/package.json index a5881a38..52bc7389 100644 --- a/examples/config-babel/package.json +++ b/examples/config-babel/package.json @@ -9,6 +9,9 @@ "url": "https://cezaraugusto.com" }, "devDependencies": { + "@babel/core": "^7.24.9", + "babel-loader": "^9.1.3", + "babel-preset-modern-browser-extension": "^0.7.0", "stylelint": "^16.7.0" } } diff --git a/examples/config-stylelint/.stylelintrc.json b/examples/config-stylelint/.stylelintrc.json new file mode 100644 index 00000000..eff25609 --- /dev/null +++ b/examples/config-stylelint/.stylelintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-standard-scss" +} diff --git a/examples/config-stylelint/newtab/index.html b/examples/config-stylelint/newtab/index.html index f046481e..adf383c4 100644 --- a/examples/config-stylelint/newtab/index.html +++ b/examples/config-stylelint/newtab/index.html @@ -14,7 +14,7 @@ href="https://unpkg.com/sakura.css/css/sakura-dark.css" media="screen and (prefers-color-scheme: dark)" /> - +
diff --git a/examples/config-stylelint/newtab/styles.css b/examples/config-stylelint/newtab/styles.scss similarity index 100% rename from examples/config-stylelint/newtab/styles.css rename to examples/config-stylelint/newtab/styles.scss diff --git a/examples/config-stylelint/package.json b/examples/config-stylelint/package.json index a9725e53..67e4e045 100644 --- a/examples/config-stylelint/package.json +++ b/examples/config-stylelint/package.json @@ -9,10 +9,11 @@ "url": "https://cezaraugusto.com" }, "scripts": { - "lint:css": "stylelint '**/*.css'" + "lint:css": "npx stylelint '**/*.scss'" }, "devDependencies": { + "sass": "^1.77.8", "stylelint": "^16.7.0", - "stylelint-config-standard": "^36.0.1" + "stylelint-config-standard-scss": "^13.1.0" } } diff --git a/examples/config-stylelint/stylelint.config.json b/examples/config-stylelint/stylelint.config.json deleted file mode 100644 index 31ecd879..00000000 --- a/examples/config-stylelint/stylelint.config.json +++ /dev/null @@ -1 +0,0 @@ -{"extends": ["stylelint-config-standard"]} diff --git a/examples/init/manifest.json b/examples/init/manifest.json index 9b690e1b..db51939f 100644 --- a/examples/init/manifest.json +++ b/examples/init/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "version": "0.0.1", - "name": "Initial Template", + "name": "Init Template", "description": "An Extension.js example.", "icons": { "16": "images/extension_16.png", diff --git a/examples/types.ts b/examples/types.ts index 4977dd72..47e96b59 100644 --- a/examples/types.ts +++ b/examples/types.ts @@ -3,7 +3,6 @@ export type ConfigFiles = | 'postcss.config.js' | 'tailwind.config.js' | 'tsconfig.json' - | 'babel.config.js' | 'stylelint.config.json' | 'extension.config.js' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c555688d..c70219f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,18 +93,30 @@ importers: examples/config-babel: devDependencies: + '@babel/core': + specifier: ^7.24.9 + version: 7.25.2 + babel-loader: + specifier: ^9.1.3 + version: 9.1.3(@babel/core@7.25.2)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) + babel-preset-modern-browser-extension: + specifier: ^0.7.0 + version: 0.7.0(@babel/core@7.25.2) stylelint: specifier: ^16.7.0 version: 16.9.0(typescript@5.3.3) examples/config-stylelint: devDependencies: + sass: + specifier: ^1.77.8 + version: 1.78.0 stylelint: specifier: ^16.7.0 version: 16.9.0(typescript@5.3.3) - stylelint-config-standard: - specifier: ^36.0.1 - version: 36.0.1(stylelint@16.9.0(typescript@5.3.3)) + stylelint-config-standard-scss: + specifier: ^13.1.0 + version: 13.1.0(postcss@8.4.45)(stylelint@16.9.0(typescript@5.3.3)) examples/content: {} @@ -455,12 +467,12 @@ importers: cross-spawn: specifier: ^7.0.3 version: 7.0.3 - detect-package-manager: - specifier: ^3.0.2 - version: 3.0.2 go-git-it: specifier: 2.0.4 version: 2.0.4 + package-manager-detector: + specifier: ^0.2.0 + version: 0.2.0 devDependencies: '@types/cross-spawn': specifier: ^6.0.6 @@ -519,9 +531,6 @@ importers: axios: specifier: ^1.6.8 version: 1.7.7 - browser-extension-manifest-fields: - specifier: ^1.0.6 - version: 1.0.6 case-sensitive-paths-webpack-plugin: specifier: ^2.4.0 version: 2.4.0 @@ -540,9 +549,6 @@ importers: csv-loader: specifier: ^3.0.5 version: 3.0.5 - detect-package-manager: - specifier: ^3.0.2 - version: 3.0.2 dotenv-webpack: specifier: ^8.0.1 version: 8.1.0(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) @@ -570,6 +576,9 @@ importers: mini-css-extract-plugin: specifier: ^2.8.1 version: 2.9.1(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) + package-manager-detector: + specifier: ^0.2.0 + version: 0.2.0 parse5: specifier: ^7.1.2 version: 7.1.2 @@ -613,27 +622,18 @@ importers: specifier: ^1.1.2 version: 1.1.2(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) optionalDependencies: - '@babel/core': - specifier: ^7.24.9 - version: 7.25.2 '@pmmmwh/react-refresh-webpack-plugin': specifier: ^0.5.15 version: 0.5.15(@types/webpack@4.41.39)(react-refresh@0.14.2)(type-fest@0.21.3)(webpack-dev-server@5.1.0(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)))(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) '@prefresh/webpack': specifier: ^4.0.1 version: 4.0.1(@prefresh/babel-plugin@0.5.1)(preact@10.23.2)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) - '@vue/compiler-sfc': - specifier: ^3.4.34 - version: 3.5.3 babel-loader: specifier: ^9.1.3 version: 9.1.3(@babel/core@7.25.2)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) babel-preset-modern-browser-extension: specifier: ^0.7.0 version: 0.7.0(@babel/core@7.25.2) - less: - specifier: ^4.2.0 - version: 4.2.0 less-loader: specifier: ^12.2.0 version: 12.2.0(less@4.2.0)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) @@ -661,27 +661,12 @@ importers: resolve-url-loader: specifier: ^5.0.0 version: 5.0.0 - sass: - specifier: ^1.77.8 - version: 1.78.0 sass-loader: specifier: ^16.0.0 version: 16.0.1(sass@1.78.0)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) - stylelint: - specifier: ^16.7.0 - version: 16.9.0(typescript@5.3.3) - stylelint-config-standard-scss: - specifier: ^13.1.0 - version: 13.1.0(postcss@8.4.45)(stylelint@16.9.0(typescript@5.3.3)) - stylelint-webpack-plugin: - specifier: ^5.0.1 - version: 5.0.1(stylelint@16.9.0(typescript@5.3.3))(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) - tailwindcss: - specifier: ^3.4.7 - version: 3.4.10(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) vue-loader: specifier: ^17.4.2 - version: 17.4.2(@vue/compiler-sfc@3.5.3)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) + version: 17.4.2(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)) vue-style-loader: specifier: ^4.1.3 version: 4.1.3 @@ -718,10 +703,10 @@ importers: version: 0.10.7 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) + version: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@20.16.5)(typescript@5.3.3)) ts-jest: specifier: ^29.1.2 - version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)))(typescript@5.3.3) + version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3) tsup: specifier: ^8.0.1 version: 8.2.4(@swc/core@1.7.23)(jiti@1.21.6)(postcss@8.4.45)(typescript@5.3.3)(yaml@2.5.1) @@ -2944,10 +2929,6 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - browser-extension-manifest-fields@1.0.6: - resolution: {integrity: sha512-LtINcoKkfJDAXTIrgYKzTAtoo/vXVh0lk8s1pfG7S4VhX/xhASf1K26fhHXWpJm2yvOakp28PG/wjmBnCEK8kQ==} - engines: {node: '>=18'} - browserslist@4.23.3: resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -3359,10 +3340,6 @@ packages: detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} - detect-package-manager@3.0.2: - resolution: {integrity: sha512-8JFjJHutStYrfWwzfretQoyNGoZVW1Fsrp4JO9spa7h/fBfwgTMEIy4/LBzRDGsxwVPHU0q+T9YvwLDJoOApLQ==} - engines: {node: '>=12'} - didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} @@ -5658,13 +5635,6 @@ packages: peerDependencies: stylelint: ^16.0.2 - stylelint-webpack-plugin@5.0.1: - resolution: {integrity: sha512-07lpo1uVoFctKv0EOOg/YSrUppcLMjNBSMRqgooNnlbfAOgQfMzvLK+EbXz0HQiEgZobr+XQX9md/TgwTGdzbw==} - engines: {node: '>= 18.12.0'} - peerDependencies: - stylelint: ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 - webpack: ^5.0.0 - stylelint@16.9.0: resolution: {integrity: sha512-31Nm3WjxGOBGpQqF43o3wO9L5AC36TPIe6030Lnm13H3vDMTcS21DrLh69bMX+DBilKqMMVLian4iG6ybBoNRQ==} engines: {node: '>=18.12.0'} @@ -6459,7 +6429,6 @@ snapshots: '@babel/plugin-syntax-decorators': 7.24.7(@babel/core@7.25.2) transitivePeerDependencies: - supports-color - optional: true '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.25.2)': dependencies: @@ -6489,7 +6458,6 @@ snapshots: dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 - optional: true '@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.25.2)': dependencies: @@ -7722,41 +7690,6 @@ snapshots: - supports-color - ts-node - '@jest/core@29.7.0(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3))': - dependencies: - '@jest/console': 29.7.0 - '@jest/reporters': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.16.5 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - ci-info: 3.9.0 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-resolve-dependencies: 29.7.0 - jest-runner: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - jest-watcher: 29.7.0 - micromatch: 4.0.8 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-ansi: 6.0.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - ts-node - '@jest/environment@29.7.0': dependencies: '@jest/fake-timers': 29.7.0 @@ -8844,7 +8777,6 @@ snapshots: find-cache-dir: 4.0.0 schema-utils: 4.2.0 webpack: 5.92.1(@swc/core@1.7.23)(esbuild@0.23.1) - optional: true babel-plugin-istanbul@6.1.1: dependencies: @@ -8887,11 +8819,9 @@ snapshots: transitivePeerDependencies: - supports-color - babel-plugin-react-require@4.0.3: - optional: true + babel-plugin-react-require@4.0.3: {} - babel-plugin-transform-react-remove-prop-types@0.4.24: - optional: true + babel-plugin-transform-react-remove-prop-types@0.4.24: {} babel-preset-current-node-syntax@1.1.0(@babel/core@7.25.2): dependencies: @@ -8930,7 +8860,6 @@ snapshots: transitivePeerDependencies: - '@babel/core' - supports-color - optional: true balanced-match@1.0.2: {} @@ -8983,12 +8912,6 @@ snapshots: dependencies: fill-range: 7.1.1 - browser-extension-manifest-fields@1.0.6: - dependencies: - glob: 10.4.5 - parse5: 7.1.2 - parse5-utils: 2.0.0 - browserslist@4.23.3: dependencies: caniuse-lite: 1.0.30001658 @@ -9127,8 +9050,7 @@ snapshots: commander@7.2.0: {} - common-path-prefix@3.0.0: - optional: true + common-path-prefix@3.0.0: {} compressible@2.0.18: dependencies: @@ -9237,21 +9159,6 @@ snapshots: - supports-color - ts-node - create-jest@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)): - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - jest-util: 29.7.0 - prompts: 2.4.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - create-require@1.1.1: {} cross-spawn@5.1.0: @@ -9400,10 +9307,6 @@ snapshots: detect-node@2.1.0: {} - detect-package-manager@3.0.2: - dependencies: - execa: 5.1.1 - didyoumean@1.2.2: {} diff-sequences@29.6.3: {} @@ -9780,7 +9683,6 @@ snapshots: dependencies: common-path-prefix: 3.0.0 pkg-dir: 7.0.0 - optional: true find-up@4.1.0: dependencies: @@ -9796,7 +9698,6 @@ snapshots: dependencies: locate-path: 7.2.0 path-exists: 5.0.0 - optional: true firefox-profile@4.7.0: dependencies: @@ -10316,25 +10217,6 @@ snapshots: - supports-color - ts-node - jest-cli@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)): - dependencies: - '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - chalk: 4.1.2 - create-jest: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - exit: 0.1.2 - import-local: 3.2.0 - jest-config: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - jest-util: 29.7.0 - jest-validate: 29.7.0 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - jest-config@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@20.16.5)(typescript@5.3.3)): dependencies: '@babel/core': 7.25.2 @@ -10366,37 +10248,6 @@ snapshots: - babel-plugin-macros - supports-color - jest-config@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)): - dependencies: - '@babel/core': 7.25.2 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.25.2) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0 - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 20.16.5 - ts-node: 10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - jest-config@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@20.16.5)(typescript@5.3.3)): dependencies: '@babel/core': 7.25.2 @@ -10428,37 +10279,6 @@ snapshots: - babel-plugin-macros - supports-color - jest-config@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)): - dependencies: - '@babel/core': 7.25.2 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.25.2) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0 - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 22.5.4 - ts-node: 10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - jest-diff@29.7.0: dependencies: chalk: 4.1.2 @@ -10675,7 +10495,7 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 22.5.4 + '@types/node': 20.16.5 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -10704,18 +10524,6 @@ snapshots: - supports-color - ts-node - jest@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)): - dependencies: - '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - '@jest/types': 29.6.3 - import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - jiti@1.21.6: {} joycon@3.1.1: {} @@ -10841,7 +10649,6 @@ snapshots: locate-path@7.2.0: dependencies: p-locate: 6.0.0 - optional: true lodash.debounce@4.0.8: {} @@ -11100,7 +10907,6 @@ snapshots: p-limit@4.0.0: dependencies: yocto-queue: 1.1.1 - optional: true p-locate@4.1.0: dependencies: @@ -11113,7 +10919,6 @@ snapshots: p-locate@6.0.0: dependencies: p-limit: 4.0.0 - optional: true p-map@2.1.0: {} @@ -11158,8 +10963,7 @@ snapshots: path-exists@4.0.0: {} - path-exists@5.0.0: - optional: true + path-exists@5.0.0: {} path-is-absolute@1.0.1: {} @@ -11197,7 +11001,6 @@ snapshots: pkg-dir@7.0.0: dependencies: find-up: 6.3.0 - optional: true postcss-attribute-case-insensitive@6.0.3(postcss@8.4.45): dependencies: @@ -11373,8 +11176,7 @@ snapshots: postcss-value-parser: 4.2.0 optional: true - postcss-media-query-parser@0.2.3: - optional: true + postcss-media-query-parser@0.2.3: {} postcss-modules-extract-imports@3.1.0(postcss@8.4.45): dependencies: @@ -11527,7 +11329,6 @@ snapshots: postcss-scss@4.0.9(postcss@8.4.45): dependencies: postcss: 8.4.45 - optional: true postcss-selector-not@7.0.2(postcss@8.4.45): dependencies: @@ -12090,7 +11891,6 @@ snapshots: stylelint-scss: 6.5.1(stylelint@16.9.0(typescript@5.3.3)) optionalDependencies: postcss: 8.4.45 - optional: true stylelint-config-recommended@14.0.1(stylelint@16.9.0(typescript@5.3.3)): dependencies: @@ -12103,7 +11903,6 @@ snapshots: stylelint-config-standard: 36.0.1(stylelint@16.9.0(typescript@5.3.3)) optionalDependencies: postcss: 8.4.45 - optional: true stylelint-config-standard@36.0.1(stylelint@16.9.0(typescript@5.3.3)): dependencies: @@ -12120,18 +11919,6 @@ snapshots: postcss-selector-parser: 6.1.2 postcss-value-parser: 4.2.0 stylelint: 16.9.0(typescript@5.3.3) - optional: true - - stylelint-webpack-plugin@5.0.1(stylelint@16.9.0(typescript@5.3.3))(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)): - dependencies: - globby: 11.1.0 - jest-worker: 29.7.0 - micromatch: 4.0.8 - normalize-path: 3.0.0 - schema-utils: 4.2.0 - stylelint: 16.9.0(typescript@5.3.3) - webpack: 5.92.1(@swc/core@1.7.23)(esbuild@0.23.1) - optional: true stylelint@16.9.0(typescript@5.3.3): dependencies: @@ -12388,26 +12175,6 @@ snapshots: babel-jest: 29.7.0(@babel/core@7.25.2) esbuild: 0.23.1 - ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)))(typescript@5.3.3): - dependencies: - bs-logger: 0.2.6 - ejs: 3.1.10 - fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@22.5.4)(ts-node@10.9.2(@swc/core@1.7.23)(@types/node@22.5.4)(typescript@5.3.3)) - jest-util: 29.7.0 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.6.3 - typescript: 5.3.3 - yargs-parser: 21.1.1 - optionalDependencies: - '@babel/core': 7.25.2 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.25.2) - esbuild: 0.23.1 - ts-node@10.9.2(@swc/core@1.7.23)(@types/node@20.16.5)(typescript@5.3.3): dependencies: '@cspotcode/source-map-support': 0.8.1 @@ -12586,14 +12353,12 @@ snapshots: vary@1.1.2: {} - vue-loader@17.4.2(@vue/compiler-sfc@3.5.3)(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)): + vue-loader@17.4.2(webpack@5.92.1(@swc/core@1.7.23)(esbuild@0.23.1)): dependencies: chalk: 4.1.2 hash-sum: 2.0.0 watchpack: 2.4.2 webpack: 5.92.1(@swc/core@1.7.23)(esbuild@0.23.1) - optionalDependencies: - '@vue/compiler-sfc': 3.5.3 optional: true vue-style-loader@4.1.3: @@ -12828,5 +12593,4 @@ snapshots: yocto-queue@0.1.0: {} - yocto-queue@1.1.1: - optional: true + yocto-queue@1.1.1: {} diff --git a/programs/create/lib/messages.ts b/programs/create/lib/messages.ts index 473b5466..fac33193 100644 --- a/programs/create/lib/messages.ts +++ b/programs/create/lib/messages.ts @@ -16,7 +16,7 @@ import { underline } from '@colors/colors/safe' import fs from 'fs/promises' -import {detect} from 'detect-package-manager' +import {detect} from 'package-manager-detector' export function destinationNotWriteable(workingDir: string) { const workingDirFolder = path.basename(workingDir) @@ -79,7 +79,7 @@ export async function successfullInstall( let command = 'npm run' - switch (pm) { + switch (pm?.name) { case 'yarn': command = 'yarn dev' break diff --git a/programs/create/lib/utils.ts b/programs/create/lib/utils.ts index fda7ab93..066bf557 100644 --- a/programs/create/lib/utils.ts +++ b/programs/create/lib/utils.ts @@ -7,7 +7,7 @@ import fs from 'fs/promises' import path from 'path' -import {detect} from 'detect-package-manager' +import {detect} from 'package-manager-detector' import * as messages from './messages' export async function copyDirectory(source: string, destination: string) { @@ -39,7 +39,7 @@ export async function getInstallCommand() { } } - switch (pm) { + switch (pm?.name) { case 'yarn': command = 'yarn' break diff --git a/programs/create/package.json b/programs/create/package.json index 5cf9f69f..2624d47f 100644 --- a/programs/create/package.json +++ b/programs/create/package.json @@ -32,8 +32,8 @@ "@colors/colors": "^1.6.0", "@types/firefox-webext-browser": "^120.0.4", "cross-spawn": "^7.0.3", - "detect-package-manager": "^3.0.2", - "go-git-it": "2.0.4" + "go-git-it": "2.0.4", + "package-manager-detector": "^0.2.0" }, "devDependencies": { "@types/cross-spawn": "^6.0.6", diff --git a/programs/develop/build.spec.ts b/programs/develop/build.spec.ts index c08cd786..c8ba9143 100644 --- a/programs/develop/build.spec.ts +++ b/programs/develop/build.spec.ts @@ -172,7 +172,7 @@ describe('extension build', () => { templatePath, 'dist', SUPPORTED_BROWSERS[0], - `${template.name}-0.0.1.zip` + `${template.name}-template-0.0.1.zip` ) ) ).toBeTruthy() @@ -196,10 +196,10 @@ describe('extension build', () => { browser: SUPPORTED_BROWSERS[0] as 'chrome', zipSource: true }) - + expect( fs.existsSync( - path.join(templatePath, 'dist', `${template.name}-0.0.1-source.zip`) + path.join(templatePath, 'dist', `${template.name}-template-0.0.1-source.zip`) ) ).toBeTruthy() }, diff --git a/programs/develop/commands/commands-lib/generate-zip.ts b/programs/develop/commands/commands-lib/generate-zip.ts index 7c3be4bf..3220c630 100644 --- a/programs/develop/commands/commands-lib/generate-zip.ts +++ b/programs/develop/commands/commands-lib/generate-zip.ts @@ -85,7 +85,7 @@ export async function generateZip( if (options.zipSource) { console.log('') - console.log(messages.packagingSourceFiles(browser)) + console.log(messages.packagingSourceFiles(sourceZipPath)) const zip = new AdmZip() const files = await getFilesToZip(projectDir) diff --git a/programs/develop/commands/commands-lib/install-dependencies.ts b/programs/develop/commands/commands-lib/install-dependencies.ts index 39178605..183c5d0c 100644 --- a/programs/develop/commands/commands-lib/install-dependencies.ts +++ b/programs/develop/commands/commands-lib/install-dependencies.ts @@ -1,7 +1,7 @@ import path from 'path' import {spawn} from 'cross-spawn' import fs from 'fs' -import {detect} from 'detect-package-manager' +import {detect} from 'package-manager-detector' import * as messages from './messages' import {isFromPnpx} from '../../webpack/lib/utils' @@ -14,7 +14,7 @@ export async function getInstallCommand() { return 'pnpm' } - switch (pm) { + switch (pm?.name) { case 'yarn': command = 'yarn' break diff --git a/programs/develop/package.json b/programs/develop/package.json index e652e1a4..460c0cd3 100644 --- a/programs/develop/package.json +++ b/programs/develop/package.json @@ -39,14 +39,12 @@ "ajv": "^8.17.1", "astring": "^1.8.6", "axios": "^1.6.8", - "browser-extension-manifest-fields": "^1.0.6", "case-sensitive-paths-webpack-plugin": "^2.4.0", "chokidar": "^3.6.0", "chrome-location": "^1.2.1", "content-security-policy-parser": "^0.6.0", "css-loader": "^6.10.0", "csv-loader": "^3.0.5", - "detect-package-manager": "^3.0.2", "dotenv-webpack": "^8.0.1", "edge-location": "^1.0.0", "firefox-profile": "^4.6.0", @@ -56,6 +54,7 @@ "loader-utils": "^3.3.1", "micromatch": "^4.0.7", "mini-css-extract-plugin": "^2.8.1", + "package-manager-detector": "^0.2.0", "parse5": "^7.1.2", "parse5-utils": "^2.0.0", "postcss": "^8.4.45", @@ -88,13 +87,10 @@ "typescript": "5.3.3" }, "optionalDependencies": { - "@babel/core": "^7.24.9", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", "@prefresh/webpack": "^4.0.1", - "@vue/compiler-sfc": "^3.4.34", "babel-loader": "^9.1.3", "babel-preset-modern-browser-extension": "^0.7.0", - "less": "^4.2.0", "less-loader": "^12.2.0", "postcss-flexbugs-fixes": "^5.0.2", "postcss-loader": "^8.1.1", @@ -104,12 +100,7 @@ "react-refresh": "^0.14.2", "react-refresh-typescript": "^2.0.9", "resolve-url-loader": "^5.0.0", - "sass": "^1.77.8", "sass-loader": "^16.0.0", - "stylelint": "^16.7.0", - "stylelint-config-standard-scss": "^13.1.0", - "stylelint-webpack-plugin": "^5.0.1", - "tailwindcss": "^3.4.7", "vue-loader": "^17.4.2", "vue-style-loader": "^4.1.3", "vue-template-compiler": "^2.7.16" diff --git a/programs/develop/webpack/lib/__spec__/utils.spec.ts b/programs/develop/webpack/lib/__spec__/utils.spec.ts index 2791afed..ff82ed3a 100644 --- a/programs/develop/webpack/lib/__spec__/utils.spec.ts +++ b/programs/develop/webpack/lib/__spec__/utils.spec.ts @@ -6,7 +6,7 @@ import {Manifest, FilepathList} from '../../webpack-types' jest.mock('fs') jest.mock('child_process') -jest.mock('detect-package-manager') +jest.mock('package-manager-detector') describe('utils', () => { describe('getResolvedPath', () => { diff --git a/programs/develop/webpack/lib/utils.ts b/programs/develop/webpack/lib/utils.ts index 2330b68a..d22c41eb 100644 --- a/programs/develop/webpack/lib/utils.ts +++ b/programs/develop/webpack/lib/utils.ts @@ -2,7 +2,7 @@ import path from 'path' import fs from 'fs' import {type Compilation} from 'webpack' import {execSync} from 'child_process' -import {detect} from 'detect-package-manager' +import {detect} from 'package-manager-detector' import * as messages from './messages' import {type Manifest, type FilepathList} from '../webpack-types' import {CHROMIUM_BASED_BROWSERS} from './constants' @@ -140,14 +140,20 @@ export async function installOptionalDependencies( try { const pm = await detect() - console.log(messages.integrationNotInstalled(packageName, integration, pm)) + console.log( + messages.integrationNotInstalled( + packageName, + integration, + pm?.name || 'unknown' + ) + ) let installCommand = '' - if (pm === 'yarn') { + if (pm?.name === 'yarn') { installCommand = `yarn --silent add ${dependencies.join( ' ' )} --cwd ${__dirname} --optional` - } else if (pm === 'npm' || isFromNpx()) { + } else if (pm?.name === 'npm' || isFromNpx()) { installCommand = `npm --silent install ${dependencies.join( ' ' )} --prefix ${__dirname} --save-optional` @@ -169,9 +175,9 @@ export async function installOptionalDependencies( if (process.env.EXTENSION_ENV === 'development') { console.log(messages.installingRootDependencies(packageName, integration)) - if (pm === 'yarn') { + if (pm?.name === 'yarn') { installCommand = `yarn install --silent > /dev/null 2>&1` - } else if (pm === 'npm' || isFromNpx()) { + } else if (pm?.name === 'npm' || isFromNpx()) { installCommand = `npm install --silent > /dev/null 2>&1` } else if (isFromPnpx()) { installCommand = `pnpm install --silent > /dev/null 2>&1` diff --git a/programs/develop/webpack/plugin-css/css-tools/stylelint.ts b/programs/develop/webpack/plugin-css/css-tools/stylelint.ts index b52a3b8b..8e90547b 100644 --- a/programs/develop/webpack/plugin-css/css-tools/stylelint.ts +++ b/programs/develop/webpack/plugin-css/css-tools/stylelint.ts @@ -9,7 +9,6 @@ import path from 'path' import fs from 'fs' import {type WebpackPluginInstance} from 'webpack' import * as messages from '../../lib/messages' -import {installOptionalDependencies} from '../../lib/utils' export function getStylelintConfigFile(projectPath: string) { const stylelintConfigJs = path.join(projectPath, 'stylelint.config.json') @@ -67,40 +66,7 @@ export function isUsingStylelint(projectPath: string) { export async function maybeUseStylelint( projectPath: string ): Promise { - if (!isUsingStylelint(projectPath)) return [] + isUsingStylelint(projectPath) - try { - require.resolve('stylelint') - } catch (e) { - const stylelintDependencies = [ - 'stylelint', - 'stylelint-webpack-plugin', - 'stylelint-config-standard-scss' - ] - const projectName = require(path.join(projectPath, 'package.json')).name - await installOptionalDependencies( - projectName, - 'Stylelint', - stylelintDependencies - ) - - // The compiler will exit after installing the dependencies - // as it can't read the new dependencies without a restart. - - console.log(messages.youAreAllSet(projectName, 'Stylelint')) - process.exit(0) - } - - const StylelintPlugin = require('stylelint-webpack-plugin') - - return [ - new StylelintPlugin({ - context: projectPath, - configFile: isUsingStylelint(projectPath) - ? getStylelintConfigFile(projectPath) - : path.join(__dirname, 'stylelint.config.json'), - files: '**/*.{css,scss,sass,less}', - exclude: ['node_modules', path.join(projectPath, 'node_modules')] - }) - ] + return [] } diff --git a/programs/develop/webpack/plugin-js-frameworks/js-tools/babel.ts b/programs/develop/webpack/plugin-js-frameworks/js-tools/babel.ts index 1f66140e..595d35a7 100644 --- a/programs/develop/webpack/plugin-js-frameworks/js-tools/babel.ts +++ b/programs/develop/webpack/plugin-js-frameworks/js-tools/babel.ts @@ -9,10 +9,7 @@ import path from 'path' import fs from 'fs' import {Compiler} from 'webpack' import * as messages from '../../lib/messages' -import {installOptionalDependencies} from '../../lib/utils' -import {isUsingPreact} from './preact' import {DevOptions} from '../../../commands/dev' -import {isUsingTypeScript, maybeUseTypeScript} from './typescript' import {JsFramework} from '../../webpack-types' let userMessageDelivered = false @@ -86,9 +83,6 @@ export function babelConfig( typescript: boolean } ) { - const presetModernExtensions = - require('babel-preset-modern-browser-extension').default - return { // When set, the given directory will be used to cache the results // of the loader. Future webpack builds will attempt to read from @@ -105,69 +99,15 @@ export function babelConfig( cacheCompression: false, babelrc: false, configFile: getBabelConfigFile(projectPath), - compact: opts.mode === 'production', - overrides: [presetModernExtensions(opts).overrides], - presets: [...presetModernExtensions(opts).presets], - plugins: [ - ...presetModernExtensions(opts).plugins, - process.env.NODE_ENV !== 'test' && - opts.mode === 'development' && - isUsingPreact(projectPath) && - require.resolve('react-refresh/babel') - ].filter(Boolean) + compact: opts.mode === 'production' } } export async function maybeUseBabel( - compiler: Compiler, + _compiler: Compiler, projectPath: string ): Promise { - if (!isUsingBabel(projectPath)) return undefined - - try { - require.resolve('babel-loader') - } catch (e) { - const babelDependencies = [ - '@babel/core', - 'babel-loader', - 'babel-preset-modern-browser-extension' - ] - - const manifest = require(path.join(projectPath, 'manifest.json')) - const manifestName = manifest.name || 'Extension.js' - - await installOptionalDependencies(manifestName, 'Babel', babelDependencies) - - // The compiler will exit after installing the dependencies - // as it can't read the new dependencies without a restart. - console.log(messages.youAreAllSet(manifestName, 'Babel')) - process.exit(0) - } - - // Prevent users from running ts/tsx files when not using TypeScript - const files = isUsingTypeScript(projectPath) - ? /\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/ - : /\.(js|mjs|jsx|mjsx)$/ - - const mode = compiler.options.mode - const maybeInstallTypeScript = await maybeUseTypeScript(projectPath) + isUsingBabel(projectPath) - return { - plugins: undefined, - loaders: [ - // https://webpack.js.org/loaders/babel-loader/ - // https://babeljs.io/docs/en/babel-loader - { - test: files, - include: projectPath, - exclude: /node_modules/, - loader: require.resolve('babel-loader'), - options: babelConfig(projectPath, { - mode, - typescript: maybeInstallTypeScript - }) - } - ], - alias: undefined - } + return undefined } diff --git a/programs/develop/webpack/plugin-js-frameworks/js-tools/vue.ts b/programs/develop/webpack/plugin-js-frameworks/js-tools/vue.ts index 1ab8e50b..e38cfe2e 100644 --- a/programs/develop/webpack/plugin-js-frameworks/js-tools/vue.ts +++ b/programs/develop/webpack/plugin-js-frameworks/js-tools/vue.ts @@ -63,7 +63,6 @@ export async function maybeUseVue( const vueDependencies = [ 'vue-loader', - '@vue/compiler-sfc', 'vue-template-compiler', 'vue-style-loader' ]