diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 1fcb434bb4..bb1b381436 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -11,6 +11,5 @@ jobs: with: build-script: 'compile' omit-unchanged: 'true' - exclude: './packages/react-native-web/dist/cjs/{index.js,**/*.js}' pattern: './packages/react-native-web/dist/{index.js,**/*.js}' repo-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/babel.config.js b/babel.config.js index 5af976d179..9cc83c0ad1 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,18 +1,30 @@ -const createConfig = ({ modules }) => { - const plugins = [ - ['babel-plugin-syntax-hermes-parser', { parseLangTypes: 'flow' }], - '@babel/plugin-transform-flow-strip-types' - ].concat(modules ? ['babel-plugin-add-module-exports'] : []); - +export default function (api) { return { - plugins, + plugins: [ + ['babel-plugin-syntax-hermes-parser', { parseLangTypes: 'flow' }], + '@babel/plugin-transform-flow-strip-types', + + ...(api.env('test') + ? // Jest resolves paths without extensions. The extensions depend on other + // files on disk, which Jest's transform cache does not track. + [] + : // Output is published as "type": "module", which requires fully specified + // import paths (e.g. './View/index.js', 'fbjs/lib/invariant.js') + // Only list packages without an "exports" field in `includePackages` + [ + [ + 'babel-plugin-fully-specified', + { includePackages: ['fbjs/', 'styleq/'] } + ] + ]) + ], presets: [ ['@babel/preset-react', { useSpread: true }], [ '@babel/preset-env', { loose: true, - modules, + modules: false, targets: { browsers: ['chrome 96', 'firefox 94', 'safari 15.1', 'ios_saf 15.1'] } @@ -20,14 +32,4 @@ const createConfig = ({ modules }) => { ] ] }; -}; - -module.exports = function (api) { - if (api) { - api.cache(true); - } - - return process.env.BABEL_ENV === 'commonjs' || process.env.NODE_ENV === 'test' - ? createConfig({ modules: 'commonjs' }) - : createConfig({ modules: false }); -}; +} diff --git a/jest.config.js b/jest.config.js index c004a64858..6be0057cdd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,3 @@ -'use strict'; - -const babelConfig = require('./babel.config.js'); - const shared = { coveragePathIgnorePatterns: [ '/node_modules/', @@ -22,22 +18,26 @@ const shared = { printBasicPrototype: false }, transform: { - '\\.[jt]sx?$': ['babel-jest', babelConfig()] + '\\.[jt]sx?$': 'babel-jest' } }; -module.exports = { +export default { projects: [ { ...shared, displayName: 'dom', - setupFiles: [require.resolve('./jest.setup.dom.js')], + setupFiles: [ + '/jest.setup.globals.js', + '/jest.setup.dom.js' + ], testEnvironment: 'jsdom', testMatch: ['**/__tests__/**/?(*-)+(spec|test).[jt]s?(x)'] }, { ...shared, displayName: 'node', + setupFiles: ['/jest.setup.globals.js'], testEnvironment: 'node', testMatch: ['**/__tests__/**/?(*-)+(spec|test).node.[jt]s?(x)'] } diff --git a/jest.setup.globals.js b/jest.setup.globals.js new file mode 100644 index 0000000000..878cc25f58 --- /dev/null +++ b/jest.setup.globals.js @@ -0,0 +1,2 @@ +// Jest does not add the `jest` global when tests run as native ES modules +globalThis.jest = import.meta.jest; diff --git a/package-lock.json b/package-lock.json index 9e419ea54e..97a6dd946c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@babel/preset-react": "^7.29.7", "@testing-library/react": "^16.3.3", "babel-jest": "^30.5.2", - "babel-plugin-add-module-exports": "^1.0.4", + "babel-plugin-fully-specified": "^1.3.1", "babel-plugin-syntax-hermes-parser": "0.37.0", "cross-env": "^10.1.0", "del-cli": "^8.0.1", @@ -34,7 +34,6 @@ "jest": "^30.5.2", "jest-environment-jsdom": "^30.5.2", "lint-staged": "^17.6.0", - "npm-run-all": "^4.1.5", "prettier": "^3.9.10", "prettier-plugin-hermes-parser": "0.37.0" } @@ -110,6 +109,67 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@11ty/chokidar-with-glob-support": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@11ty/chokidar-with-glob-support/-/chokidar-with-glob-support-1.1.0.tgz", + "integrity": "sha512-B4X9ZPBHG3j/HCT64A8a0PZMkxOj8cUSPto0L61J4KRuwX4EIuUWerggHcWc3RdUx3ih4xtvK8WGjJ4Ak7S/fQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^4.0.3", + "picomatch": "^4.0.7" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, + "node_modules/@11ty/chokidar-with-glob-support/node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@11ty/chokidar-with-glob-support/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@11ty/chokidar-with-glob-support/node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@11ty/dependency-tree": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@11ty/dependency-tree/-/dependency-tree-4.0.2.tgz", @@ -134,15 +194,16 @@ } }, "node_modules/@11ty/eleventy": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/@11ty/eleventy/-/eleventy-3.1.6.tgz", - "integrity": "sha512-ZlSiR1PLdS2lv7TelBgWAhcvMiLNZkPBlLEb+lh7kGYZ+Mk0bo9qcYgVsewvw9W7Em0RH3wd01h5fAstNDh0zA==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@11ty/eleventy/-/eleventy-3.1.7.tgz", + "integrity": "sha512-ioyq2V884tmKDxVH80OPq5cCn4IJqfV4p2BzznxNDn7o7LbA/g5RDl7zYLk5B/TUgoFyLO+dFbIawBWpAHxlyA==", "dev": true, "license": "MIT", "dependencies": { + "@11ty/chokidar-with-glob-support": "^1.1.0", "@11ty/dependency-tree": "^4.0.2", "@11ty/dependency-tree-esm": "^2.0.4", - "@11ty/eleventy-dev-server": "^2.0.8", + "@11ty/eleventy-dev-server": "^2.1.2", "@11ty/eleventy-plugin-bundle": "^3.0.7", "@11ty/eleventy-utils": "^2.0.7", "@11ty/lodash-custom": "^4.17.21", @@ -150,27 +211,26 @@ "@11ty/recursive-copy": "^4.0.4", "@sindresorhus/slugify": "^2.2.1", "bcp-47-normalize": "^2.3.0", - "chokidar": "^3.6.0", "debug": "^4.4.3", "dependency-graph": "^1.0.0", "entities": "^6.0.1", "filesize": "^10.1.6", - "gray-matter": "^4.0.3", - "iso-639-1": "^3.1.5", + "gray-matter": "npm:@11ty/gray-matter@^1.0.0", + "iso-639-1": "^3.1.6", "js-yaml": "^4.1.1", "kleur": "^4.1.5", - "liquidjs": "^10.27.0", + "liquidjs": "^10.30.0", "luxon": "^3.7.2", "markdown-it": "^14.2.0", "minimist": "^1.2.8", "moo": "0.5.2", "node-retrieve-globals": "^6.0.1", - "nunjucks": "^3.2.4", - "picomatch": "^4.0.4", + "nunjucks": "npm:@11ty/nunjucks@^3.3.0", + "picomatch": "^4.0.7", "please-upgrade-node": "^3.2.0", "posthtml": "^0.16.7", "posthtml-match-helper": "^2.0.3", - "semver": "^7.8.1", + "semver": "^7.8.5", "slugify": "^1.6.9", "tinyglobby": "^0.2.16" }, @@ -186,14 +246,14 @@ } }, "node_modules/@11ty/eleventy-dev-server": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/@11ty/eleventy-dev-server/-/eleventy-dev-server-2.0.8.tgz", - "integrity": "sha512-15oC5M1DQlCaOMUq4limKRYmWiGecDaGwryr7fTE/oM9Ix8siqMvWi+I8VjsfrGr+iViDvWcH/TVI6D12d93mA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@11ty/eleventy-dev-server/-/eleventy-dev-server-2.1.2.tgz", + "integrity": "sha512-cwReJlQtIZsFuwMhm2fXwwjj+uUVvRkuoESgDtR5Mg9tY2qRj8UbNC8xhYRBuYVpACd3E09CxGPkk/Qj15Zo+A==", "dev": true, "license": "MIT", "dependencies": { + "@11ty/chokidar-with-glob-support": "^1.1.0", "@11ty/eleventy-utils": "^2.0.1", - "chokidar": "^3.6.0", "debug": "^4.4.0", "finalhandler": "^1.3.1", "mime": "^3.0.0", @@ -328,9 +388,9 @@ } }, "node_modules/@11ty/eleventy/node_modules/markdown-it": { - "version": "14.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.2.tgz", - "integrity": "sha512-sHHjZ5fJKlgrG4qns2YwVcdNep35h5fERrfkD2YNsb9UFk0UIHarbiTaHKVMlPuWAoiilyK8Fv/jAm11slsY7Q==", + "version": "14.3.3", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.3.tgz", + "integrity": "sha512-L//tDAkjTjJCU6pBUSBTgs3Kg4InVaZuUZog/b6V12UKhcDQ7S78877ibbCanRExwPuYP1CZD7Gd2dxSy1GXRg==", "dev": true, "funding": [ { @@ -3995,15 +4055,15 @@ } }, "node_modules/@next/env": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.1.tgz", - "integrity": "sha512-5sUUrrSvs/2/2LnLoesybMGx12EtPB46fdZ6RhAw0XDGSPxU2LFyQBB7yuEiOFFJPKmBY6+q2jTr1/AMbnp0/g==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.2.tgz", + "integrity": "sha512-nTUTFH7G5/J/fmpkjVLegOkqyKOP0CEsJcMsyO4UCYeN1su+YMW/MfaSErnJskL7XM+UDK6aTvslxsRCyya/sA==", "license": "MIT" }, "node_modules/@next/swc-darwin-arm64": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.1.tgz", - "integrity": "sha512-U+hQ5Gj3fpzf4fveTIF3dpUFYhaSW8vHhdAnbiIomzXzg7boreYFgBqprepXFtW4sw+aTttiNmg0gew/iFNhbg==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.2.tgz", + "integrity": "sha512-ONkhFvZNFWlsEHOM/81AtxdyuJP2KRYKYR0JxPwvcu1AuPMMMgcL+wW2luldJvMtZwKtUxoSkCychW5wIeoYSw==", "cpu": [ "arm64" ], @@ -4017,9 +4077,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.1.tgz", - "integrity": "sha512-/hqC3V1XLUjhMASf/WridKdO9FXoEgN3HBWmtKbj00MPgnltutfraWJ3bYTpCRIgEIpbjJyOVLpYgAhh/BkdcQ==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.2.tgz", + "integrity": "sha512-luPCMbOsCoaF+kXJEUjmjmOZg1lC3BflhmUu+ZmW4tBu2vW/4AXak8JBFvePizGkxVmNiAw/r9ra+6UviCWtWQ==", "cpu": [ "x64" ], @@ -4033,9 +4093,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.1.tgz", - "integrity": "sha512-GHzncHbcaS9g95kcvTNtKQW3aCLoR+xc3Jm7qrkpk1R+D2BjMHIPyvQGRPKCdMX95BsH/421jBUK06q9tEwzjw==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.2.tgz", + "integrity": "sha512-xhwFTAncJyaCNy5KqKKuKaIIdCy1/1ZV1s5S1G0hhT7wGMkDTlfJ6aQbfRFnIG/s3/kDrxQ8aycVe+c5QnP8ow==", "cpu": [ "arm64" ], @@ -4052,9 +4112,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.1.tgz", - "integrity": "sha512-1SuJyDxW/PR9dHJat/ZRgcYLhuSZ+1psP4DlKb2tKIuXbjygqpLrJWRSq+onZQBv8LcmU67EIrmb6c3XTaJLjw==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.2.tgz", + "integrity": "sha512-T1PNmfbPcxr5ndtWUL/3wQtLXsz808lq6sc2GrNT5k2oquF7UyqZddHSuAewHVsWsGXe6nsl9HoN1YNriVjuSg==", "cpu": [ "arm64" ], @@ -4071,9 +4131,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.1.tgz", - "integrity": "sha512-Istng1hMGp9TGO4lUqeKLd70MPN/OOkucVTP2Nmj+gLkwBgmPqUw8CJYBCC7nbl/B/23bBCcjCI5Hsh6hazC1A==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.2.tgz", + "integrity": "sha512-N9cDUOCGtkJG5PNKDFZUF3xXndrJJcpLp121uAGjIGvO/U2p9tfdNOM9htj7+5f72l0m8rMw/cvYacUJBQoudg==", "cpu": [ "x64" ], @@ -4090,9 +4150,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.1.tgz", - "integrity": "sha512-aSC9wMNiZRRFVpPkPWBzRwLQxIGm/CiQcXyFF1XNcgodb+uMxdk7aSSGGpDXCbnvZdf4itjHxpOd5h7i7zaiYw==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.2.tgz", + "integrity": "sha512-yY2uh1YhX6ufuYy2FCbw1dqblbhI57GLYAJfCkqD9auTv6pLrH67Uccjc3QMKBeCYAG6lkgu08ExmX1bbjejjQ==", "cpu": [ "x64" ], @@ -4109,9 +4169,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.1.tgz", - "integrity": "sha512-t/myvwFDlypMUjRvbBf8qLPyuaB0iXYYdBtwMt6DM6f+60wtGr4bSYholdPqNeV5VUXZhrpMwfza829kmhS3iA==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.2.tgz", + "integrity": "sha512-j/ArWRIHpMMB6wYLMhr2puTguBt70lNU/Cmjl9p6dTDE8DGknYJMP9PdwPk2dqpCNL/KIX9yfngDvIesxJPmsg==", "cpu": [ "arm64" ], @@ -4125,9 +4185,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.1.tgz", - "integrity": "sha512-6ICqPo9awCkrtYNPhwkx1uU7rlFWrZRrIboDHS2LU+jv088UBYQtmJ25h6pCp27/+FZjF6BQ4Te4ErugyMeuBg==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.2.tgz", + "integrity": "sha512-AA4edyWHDko3NCSo0x6GomsdgFb0oR1J3MXU1b5xt6FRFg4AucrMPW3S0hCe/9onU0O1BbpGQBsqo1r0Gneu1g==", "cpu": [ "x64" ], @@ -5905,12 +5965,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-plugin-add-module-exports": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.4.tgz", - "integrity": "sha512-g+8yxHUZ60RcyaUpfNzy56OtWW+x9cyEe9j+CranqLiqbju2yf/Cy6ZtYK40EZxtrdHllzlVZgLmcOUCTlJ7Jg==", + "node_modules/babel-plugin-fully-specified": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/babel-plugin-fully-specified/-/babel-plugin-fully-specified-1.3.1.tgz", + "integrity": "sha512-f2N7F2SLqeG/UuLxYxjwToHUUYEq0ed5PcThIqPWmARxOU3bDaXd8ynL8+rf67y/O7ZSWcCIxgacKTJ38JKJwQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "peerDependencies": { + "@babel/core": "*" + } }, "node_modules/babel-plugin-istanbul": { "version": "8.0.0", @@ -6118,9 +6181,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.11.28", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.28.tgz", - "integrity": "sha512-br0LOmjJqr6Rt4AEkadbcNf67Zpo7EPwKsWbjnRrJIa1QYFHQBqM4C7F2WTbV8ahTEcg1Eo+Y0aWjjORInYFyA==", + "version": "2.11.29", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.29.tgz", + "integrity": "sha512-YeesxhUmR4h5y5V8KF8iBCqJb8YFrBJ++XBTeGcWIaQOYXGN19JM0FoiOjAhwuDoln8owMgXcWBmgHtYSkky2w==", "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" @@ -6181,6 +6244,7 @@ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "license": "MIT", + "optional": true, "engines": { "node": ">=8" }, @@ -6448,6 +6512,7 @@ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, "license": "MIT", + "optional": true, "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -7267,9 +7332,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.456", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.456.tgz", - "integrity": "sha512-8hboqI6xesozteFb8aa7OGknvxUtTeRJLz0FoePysUEh/oWbddykIGdgpEJRbPRg/nIMfBf2DFos+H2MtvJl2A==", + "version": "1.5.458", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.458.tgz", + "integrity": "sha512-/hIH2gRSmxrf4/X4Nw/t/Wc8PVS22l8/3HnWjWTWsTOM5dsnMUPZF/+u+yr3LqweNuTBJE1rq6qAQzKkZVwMfA==", "dev": true, "license": "ISC" }, @@ -8741,19 +8806,50 @@ "license": "MIT" }, "node_modules/gray-matter": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", - "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", + "name": "@11ty/gray-matter", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@11ty/gray-matter/-/gray-matter-1.0.0.tgz", + "integrity": "sha512-7mJJl+wf1AByoT0PknQiQfOPnVNT4fevGrUBVWO4HXsnYn1aQPyRyrELYrNUFleUBM++KzMKN6QaxHPk0t/6/g==", "dev": true, "license": "MIT", "dependencies": { - "js-yaml": "^3.13.1", - "kind-of": "^6.0.2", + "js-yaml": "^4.1.0", + "kind-of": "^6.0.3", "section-matter": "^1.0.0", "strip-bom-string": "^1.0.0" }, "engines": { - "node": ">=6.0" + "node": ">=11" + } + }, + "node_modules/gray-matter/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/gray-matter/node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, "node_modules/has-bigints": { @@ -8886,13 +8982,6 @@ "hermes-estree": "0.37.0" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "license": "ISC" - }, "node_modules/html-encoding-sniffer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", @@ -9306,6 +9395,7 @@ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "license": "MIT", + "optional": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -11116,13 +11206,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true, - "license": "MIT" - }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -11339,56 +11422,6 @@ "dev": true, "license": "MIT" }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "license": "MIT", - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/load-json-file/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -11501,9 +11534,9 @@ } }, "node_modules/markdown-it": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-15.0.2.tgz", - "integrity": "sha512-q4IGxMv56jCqT4OCRCADBoDP3LO4MhmTXjFbphHPXs4g3j9Xg5RDnxqN8IF/3vIWEU+VCnUq+7JUg/cfy2E6Qw==", + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-15.0.3.tgz", + "integrity": "sha512-+Az7Ojz3iRGu8KYMvJ6xVhvrxP3eE+vEtJX75Ow88XBpcQNV/0lGX5ZynIIBftREo4DC2jsveAMDaeltmm8QvQ==", "dev": true, "funding": [ { @@ -11517,9 +11550,9 @@ ], "license": "MIT", "dependencies": { - "argparse": "^3.0.0", - "entities": "^8.0.0", - "linkify-it": "^6.0.0", + "argparse": "^3.0.3", + "entities": "^8.1.0", + "linkify-it": "^6.1.0", "mdurl": "^2.1.0", "punycode.js": "^2.3.1", "uc.micro": "^3.0.0" @@ -11581,9 +11614,9 @@ "license": "ISC" }, "node_modules/markdown-it/node_modules/argparse": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.2.tgz", - "integrity": "sha512-mFdDM6WqWKraGLsVb+C9CahPnzTXOefAOLq3jYcca2YZ8bEWpr++Tzj+zSaKW9+X9L5uSxcm1AZ3Y6aZJ09OhQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.3.tgz", + "integrity": "sha512-Sn98ftV3KfsO8xfLPHG6oT8y+b0yvbrLgZjgPDXsharNY15tTAjqIsIju4S32nl6/iEUNNE4v+yL2Zhm8ooP3w==", "dev": true, "funding": [ { @@ -11640,15 +11673,6 @@ "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==", "license": "MIT" }, - "node_modules/memorystream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", - "dev": true, - "engines": { - "node": ">= 0.10.0" - } - }, "node_modules/meow": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/meow/-/meow-14.1.0.tgz", @@ -11963,12 +11987,12 @@ "license": "MIT" }, "node_modules/next": { - "version": "16.4.1", - "resolved": "https://registry.npmjs.org/next/-/next-16.4.1.tgz", - "integrity": "sha512-uc657V62E34fOI6W5NtG9IzwsPcms0Z60grz2MJGtglgD+pTFnNt4Yw2PzaU622tfX4vhrDgLZzicE2YlhI20Q==", + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/next/-/next-16.4.2.tgz", + "integrity": "sha512-r+oBJojfefUjOiWkBhXgLS+igxX/7BWyK59uHnyOyplMSLtBZ+QLP3okrdYTbrfrbrmNTVWLBPaHDX9KRaIt3w==", "license": "MIT", "dependencies": { - "@next/env": "16.4.1", + "@next/env": "16.4.2", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", @@ -11982,14 +12006,14 @@ "node": ">=20.9.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "16.4.1", - "@next/swc-darwin-x64": "16.4.1", - "@next/swc-linux-arm64-gnu": "16.4.1", - "@next/swc-linux-arm64-musl": "16.4.1", - "@next/swc-linux-x64-gnu": "16.4.1", - "@next/swc-linux-x64-musl": "16.4.1", - "@next/swc-win32-arm64-msvc": "16.4.1", - "@next/swc-win32-x64-msvc": "16.4.1", + "@next/swc-darwin-arm64": "16.4.2", + "@next/swc-darwin-x64": "16.4.2", + "@next/swc-linux-arm64-gnu": "16.4.2", + "@next/swc-linux-arm64-musl": "16.4.2", + "@next/swc-linux-x64-gnu": "16.4.2", + "@next/swc-linux-x64-musl": "16.4.2", + "@next/swc-win32-arm64-msvc": "16.4.2", + "@next/swc-win32-x64-msvc": "16.4.2", "sharp": "^0.35.5" }, "peerDependencies": { @@ -12043,13 +12067,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true, - "license": "MIT" - }, "node_modules/no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", @@ -12158,29 +12175,6 @@ "esm-import-transformer": "^3.0.3" } }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -12191,183 +12185,6 @@ "node": ">=0.10.0" } }, - "node_modules/npm-run-all": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", - "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "chalk": "^2.4.1", - "cross-spawn": "^6.0.5", - "memorystream": "^0.3.1", - "minimatch": "^3.0.4", - "pidtree": "^0.3.0", - "read-pkg": "^3.0.0", - "shell-quote": "^1.6.1", - "string.prototype.padend": "^3.0.0" - }, - "bin": { - "npm-run-all": "bin/npm-run-all/index.js", - "run-p": "bin/run-p/index.js", - "run-s": "bin/run-s/index.js" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/npm-run-all/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/npm-run-all/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/npm-run-all/node_modules/cross-spawn": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", - "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/npm-run-all/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/npm-run-all/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/npm-run-all/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-all/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-all/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -12401,9 +12218,10 @@ "license": "MIT" }, "node_modules/nunjucks": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.4.tgz", - "integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==", + "name": "@11ty/nunjucks", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@11ty/nunjucks/-/nunjucks-3.3.0.tgz", + "integrity": "sha512-kmMWFLcTMVeniw5G/pYV/uvPL/rN3Nm4WjRtkL9gZoXYh4cbME09ubVTHVJFr/G/h6wR89qJ8jULVqYJ4HI3yg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -12414,14 +12232,11 @@ "bin": { "nunjucks-precompile": "bin/precompile" }, - "engines": { - "node": ">= 6.9.0" - }, "peerDependencies": { - "chokidar": "^3.3.0" + "@11ty/chokidar-with-glob-support": "^1.1.0" }, "peerDependenciesMeta": { - "chokidar": { + "@11ty/chokidar-with-glob-support": { "optional": true } } @@ -12886,29 +12701,6 @@ "node": "20 || >=22" } }, - "node_modules/path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/path-type/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -12928,19 +12720,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pidtree": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", - "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", - "dev": true, - "license": "MIT", - "bin": { - "pidtree": "bin/pidtree.js" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -13485,27 +13264,13 @@ "resolved": "packages/react-native-web-examples", "link": true }, - "node_modules/read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, "license": "MIT", + "optional": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -14152,19 +13917,6 @@ "node": ">=8" } }, - "node_modules/shell-quote": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.12.0.tgz", - "integrity": "sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/side-channel": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", @@ -14313,42 +14065,6 @@ "source-map": "^0.6.0" } }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true, - "license": "CC-BY-3.0" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.24", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.24.tgz", - "integrity": "sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ==", - "dev": true, - "license": "CC0-1.0" - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -14499,25 +14215,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/string.prototype.padend": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz", - "integrity": "sha512-XZpspuSB7vJWhvJc9DLSlrXl1mcA2BdoY5jjnS135ydXqLoqhs96JjDtCkjJEQHvfqZIp9hBuBMgI589peyx9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/string.prototype.repeat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", @@ -15448,17 +15145,6 @@ "node": ">=10.12.0" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", @@ -15496,9 +15182,9 @@ } }, "node_modules/webpack": { - "version": "5.111.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.111.1.tgz", - "integrity": "sha512-cNypaz0RP+S4cvQVi1M/3bRUkvNP0xZpL0TjFx+c6jg64VbxD+2weWDgY9UnjRI6dhZgtaj8DU76GGFcJ79xPQ==", + "version": "5.112.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.112.0.tgz", + "integrity": "sha512-NIBpsRuCll036haDDt/CfcTDfsWNR9Z782nMRMI9D377BsGcYzZDTNU5TyzhCJzPIcihAxMBaMAhq2WSaDrH8Q==", "dev": true, "license": "MIT", "dependencies": { @@ -15509,16 +15195,16 @@ "@webassemblyjs/wasm-parser": "^1.14.1", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.25.0", + "enhanced-resolve": "^5.26.0", "es-module-lexer": "^2.1.0", "events": "^3.2.0", "graceful-fs": "^4.2.11", "mime-db": "^1.54.0", - "minimizer-webpack-plugin": "^5.7.0", + "minimizer-webpack-plugin": "^5.13.0", "schema-utils": "^4.5.0", "tapable": "^2.3.0", - "watchpack": "^2.5.2", - "webpack-sources": "^3.5.1" + "watchpack": "^2.6.1", + "webpack-sources": "^3.6.0" }, "bin": { "webpack": "bin/webpack.js" @@ -16019,13 +15705,6 @@ "node": ">=14.17.0" } }, - "packages/benchmarks/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "extraneous": true, - "license": "Python-2.0" - }, "packages/benchmarks/node_modules/commander": { "version": "14.0.3", "dev": true, @@ -16034,29 +15713,6 @@ "node": ">=20" } }, - "packages/benchmarks/node_modules/js-yaml": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.4.3.tgz", - "integrity": "sha512-yzzNtgczwgoVHNigCyKTXcQJU4Y8t/ikU4UxXW0BvrLfHTGWZhsNcOT2s/a7vn81/4KqVnNmHjaUEPlvWnNwVw==", - "extraneous": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/puzrin" - }, - { - "type": "github", - "url": "https://github.com/sponsors/nodeca" - } - ], - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.mjs" - } - }, "packages/benchmarks/node_modules/webpack-cli": { "version": "7.2.3", "dev": true, @@ -16125,6 +15781,9 @@ "devDependencies": { "del-cli": "^8.0.1" }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, "peerDependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" diff --git a/package.json b/package.json index de034236de..aeea421286 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "private": true, "version": "0.0.0", + "type": "module", "name": "react-ui-monorepo", "scripts": { "clean": "del-cli ./packages/*/dist", @@ -12,14 +13,15 @@ "format:fix": "prettier --write --ignore-unknown .", "lint": "eslint .", "lint:fix": "npm run lint -- --fix", + "module-map": "node ./scripts/createModuleMap.js --write", "prerelease": "npm run test && npm run build", - "release": "node ./scripts/releaseReactNativeWebPackages.js", + "release": "node ./scripts/releasePackages.js", "release:benchmarks": "git checkout gh-pages && rm -rf ./docs/benchmarks && mv packages/benchmarks/dist ./docs/benchmarks && git add -A && git commit -m \"Deploy benchmarks\" && git push origin gh-pages && git checkout -", "release:react-native-web-docs": "git checkout gh-pages && rm -rf ./docs && mv packages/react-native-web-docs/dist ./docs && git add ./docs && git commit -m \"Deploy documentation\" && git push origin gh-pages && git checkout -", "postrelease": "npm run release:react-native-web-docs && npm run release:benchmarks", "prepare": "husky", - "test": "npm run flow && npm run format && npm run lint && npm run unit --runInBand", - "unit": "cross-env NODE_OPTIONS=--experimental-vm-modules jest", + "test": "npm run flow && npm run format && npm run lint && npm run unit -- --runInBand", + "unit": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --disable-warning=ExperimentalWarning\" jest", "unit:dom": "npm run unit -- --selectProjects dom", "unit:node": "npm run unit -- --selectProjects node" }, @@ -37,7 +39,7 @@ "@babel/preset-react": "^7.29.7", "@testing-library/react": "^16.3.3", "babel-jest": "^30.5.2", - "babel-plugin-add-module-exports": "^1.0.4", + "babel-plugin-fully-specified": "^1.3.1", "babel-plugin-syntax-hermes-parser": "0.37.0", "cross-env": "^10.1.0", "del-cli": "^8.0.1", @@ -51,7 +53,6 @@ "jest": "^30.5.2", "jest-environment-jsdom": "^30.5.2", "lint-staged": "^17.6.0", - "npm-run-all": "^4.1.5", "prettier": "^3.9.10", "prettier-plugin-hermes-parser": "0.37.0" }, @@ -60,9 +61,8 @@ "packages/*" ], "lint-staged": { - "packages/react-native-web/src/index.js": [ - "node ./scripts/createBabelReactNativeWebModuleMap.js", - "prettier --write ./packages/babel-plugin-react-native-web/src/moduleMap.js" + "packages/react-native-web/src/{index.js,exports/*/index.js}": [ + "node ./scripts/createModuleMap.js" ], "**/*.js": [ "prettier --write --ignore-unknown --no-error-on-unmatched-pattern", diff --git a/packages/babel-plugin-react-native-web/README.md b/packages/babel-plugin-react-native-web/README.md index 191d57dbfa..8ce7905ff4 100644 --- a/packages/babel-plugin-react-native-web/README.md +++ b/packages/babel-plugin-react-native-web/README.md @@ -17,18 +17,10 @@ npm install --save-dev babel-plugin-react-native-web ``` { - "plugins": [ - ["react-native-web", { commonjs: true }] - ] + "plugins": ["react-native-web"] } ``` -You should configure the plugin to match the module format used by your -bundler. Most modern bundlers will use a package's ES modules by default (i.e., -if `package.json` has a `module` field). But if you need the plugin to rewrite -import paths to point to CommonJS modules, you must set the `commonjs` option -to `true`. - ## Example NOTE: `react-native-web` internal paths are _not stable_ and you must not rely @@ -44,8 +36,8 @@ import { StyleSheet, View } from 'react-native'; **After** ```js -import StyleSheet from 'react-native-web/dist/exports/StyleSheet'; -import View from 'react-native-web/dist/exports/View'; +import StyleSheet from 'react-native-web/dist/exports/StyleSheet/index.js'; +import View from 'react-native-web/dist/exports/View/index.js'; ``` [package-badge]: https://img.shields.io/npm/v/babel-plugin-react-native-web.svg?style=flat diff --git a/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap b/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap index fbb26b07df..6396b20c0d 100644 --- a/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap +++ b/packages/babel-plugin-react-native-web/src/__tests__/__snapshots__/index-test.js.snap @@ -10,33 +10,16 @@ import * as ReactNativeModules from 'react-native'; ↓ ↓ ↓ ↓ ↓ ↓ -import ReactNative from 'react-native-web/dist/index'; -import View from 'react-native-web/dist/exports/View'; -import { Invalid } from 'react-native-web/dist/index'; -import MyView from 'react-native-web/dist/exports/View'; -import useLocaleContext from 'react-native-web/dist/exports/useLocaleContext'; -import * as ReactNativeModules from 'react-native-web/dist/index'; +import ReactNative from 'react-native-web/dist/index.js'; +import View from 'react-native-web/dist/exports/View/index.js'; +import { Invalid } from 'react-native-web/dist/index.js'; +import MyView from 'react-native-web/dist/exports/View/index.js'; +import useLocaleContext from 'react-native-web/dist/exports/useLocaleContext/index.js'; +import * as ReactNativeModules from 'react-native-web/dist/index.js'; `; -exports[`Rewrite react-native to react-native-web 2. import from "react-native": 2. import from "react-native" 1`] = ` - -import ReactNative from 'react-native'; -import { View } from 'react-native'; -import { Invalid, View as MyView } from 'react-native'; -import * as ReactNativeModules from 'react-native'; - - ↓ ↓ ↓ ↓ ↓ ↓ - -import ReactNative from 'react-native-web/dist/cjs/index'; -import View from 'react-native-web/dist/cjs/exports/View'; -import { Invalid } from 'react-native-web/dist/cjs/index'; -import MyView from 'react-native-web/dist/cjs/exports/View'; -import * as ReactNativeModules from 'react-native-web/dist/cjs/index'; - -`; - -exports[`Rewrite react-native to react-native-web 3. import from "react-native-web": 3. import from "react-native-web" 1`] = ` +exports[`Rewrite react-native to react-native-web 2. import from "react-native-web": 2. import from "react-native-web" 1`] = ` import { unstable_createElement } from 'react-native-web'; import { StyleSheet, View, Pressable, processColor } from 'react-native-web'; @@ -44,44 +27,44 @@ import * as ReactNativeModules from 'react-native-web'; ↓ ↓ ↓ ↓ ↓ ↓ -import unstable_createElement from 'react-native-web/dist/exports/createElement'; -import StyleSheet from 'react-native-web/dist/exports/StyleSheet'; -import View from 'react-native-web/dist/exports/View'; -import Pressable from 'react-native-web/dist/exports/Pressable'; -import processColor from 'react-native-web/dist/exports/processColor'; -import * as ReactNativeModules from 'react-native-web/dist/index'; +import unstable_createElement from 'react-native-web/dist/exports/createElement/index.js'; +import StyleSheet from 'react-native-web/dist/exports/StyleSheet/index.js'; +import View from 'react-native-web/dist/exports/View/index.js'; +import Pressable from 'react-native-web/dist/exports/Pressable/index.js'; +import processColor from 'react-native-web/dist/exports/processColor/index.js'; +import * as ReactNativeModules from 'react-native-web/dist/index.js'; `; -exports[`Rewrite react-native to react-native-web 4. export from "react-native": 4. export from "react-native" 1`] = ` +exports[`Rewrite react-native to react-native-web 3. export from "react-native": 3. export from "react-native" 1`] = ` export { View } from 'react-native'; export { StyleSheet, Text, unstable_createElement } from 'react-native'; ↓ ↓ ↓ ↓ ↓ ↓ -export { default as View } from 'react-native-web/dist/exports/View'; -export { default as StyleSheet } from 'react-native-web/dist/exports/StyleSheet'; -export { default as Text } from 'react-native-web/dist/exports/Text'; -export { default as unstable_createElement } from 'react-native-web/dist/exports/createElement'; +export { default as View } from 'react-native-web/dist/exports/View/index.js'; +export { default as StyleSheet } from 'react-native-web/dist/exports/StyleSheet/index.js'; +export { default as Text } from 'react-native-web/dist/exports/Text/index.js'; +export { default as unstable_createElement } from 'react-native-web/dist/exports/createElement/index.js'; `; -exports[`Rewrite react-native to react-native-web 5. export from "react-native-web": 5. export from "react-native-web" 1`] = ` +exports[`Rewrite react-native to react-native-web 4. export from "react-native-web": 4. export from "react-native-web" 1`] = ` export { View } from 'react-native-web'; export { StyleSheet, Text, unstable_createElement } from 'react-native-web'; ↓ ↓ ↓ ↓ ↓ ↓ -export { default as View } from 'react-native-web/dist/exports/View'; -export { default as StyleSheet } from 'react-native-web/dist/exports/StyleSheet'; -export { default as Text } from 'react-native-web/dist/exports/Text'; -export { default as unstable_createElement } from 'react-native-web/dist/exports/createElement'; +export { default as View } from 'react-native-web/dist/exports/View/index.js'; +export { default as StyleSheet } from 'react-native-web/dist/exports/StyleSheet/index.js'; +export { default as Text } from 'react-native-web/dist/exports/Text/index.js'; +export { default as unstable_createElement } from 'react-native-web/dist/exports/createElement/index.js'; `; -exports[`Rewrite react-native to react-native-web 6. require "react-native": 6. require "react-native" 1`] = ` +exports[`Rewrite react-native to react-native-web 5. require "react-native": 5. require "react-native" 1`] = ` const ReactNative = require('react-native'); const { View } = require('react-native'); @@ -89,31 +72,16 @@ const { StyleSheet, Pressable } = require('react-native'); ↓ ↓ ↓ ↓ ↓ ↓ -const ReactNative = require('react-native-web/dist/index'); -const View = require('react-native-web/dist/exports/View').default; -const StyleSheet = require('react-native-web/dist/exports/StyleSheet').default; -const Pressable = require('react-native-web/dist/exports/Pressable').default; - -`; - -exports[`Rewrite react-native to react-native-web 7. require "react-native": 7. require "react-native" 1`] = ` - -const ReactNative = require('react-native'); -const { View } = require('react-native'); -const { StyleSheet, Pressable } = require('react-native'); - - ↓ ↓ ↓ ↓ ↓ ↓ - -const ReactNative = require('react-native-web/dist/cjs/index'); -const View = require('react-native-web/dist/cjs/exports/View').default; +const ReactNative = require('react-native-web/dist/index.js'); +const View = require('react-native-web/dist/exports/View/index.js').default; const StyleSheet = - require('react-native-web/dist/cjs/exports/StyleSheet').default; + require('react-native-web/dist/exports/StyleSheet/index.js').default; const Pressable = - require('react-native-web/dist/cjs/exports/Pressable').default; + require('react-native-web/dist/exports/Pressable/index.js').default; `; -exports[`Rewrite react-native to react-native-web 8. require "react-native-web": 8. require "react-native-web" 1`] = ` +exports[`Rewrite react-native to react-native-web 6. require "react-native-web": 6. require "react-native-web" 1`] = ` const ReactNative = require('react-native-web'); const { unstable_createElement } = require('react-native-web'); @@ -121,13 +89,15 @@ const { StyleSheet, View, Pressable, processColor } = require('react-native-web' ↓ ↓ ↓ ↓ ↓ ↓ -const ReactNative = require('react-native-web/dist/index'); +const ReactNative = require('react-native-web/dist/index.js'); const unstable_createElement = - require('react-native-web/dist/exports/createElement').default; -const StyleSheet = require('react-native-web/dist/exports/StyleSheet').default; -const View = require('react-native-web/dist/exports/View').default; -const Pressable = require('react-native-web/dist/exports/Pressable').default; + require('react-native-web/dist/exports/createElement/index.js').default; +const StyleSheet = + require('react-native-web/dist/exports/StyleSheet/index.js').default; +const View = require('react-native-web/dist/exports/View/index.js').default; +const Pressable = + require('react-native-web/dist/exports/Pressable/index.js').default; const processColor = - require('react-native-web/dist/exports/processColor').default; + require('react-native-web/dist/exports/processColor/index.js').default; `; diff --git a/packages/babel-plugin-react-native-web/src/__tests__/index-test.js b/packages/babel-plugin-react-native-web/src/__tests__/index-test.js index 79033c07c7..bbf6958591 100644 --- a/packages/babel-plugin-react-native-web/src/__tests__/index-test.js +++ b/packages/babel-plugin-react-native-web/src/__tests__/index-test.js @@ -12,15 +12,6 @@ import { useLocaleContext } from 'react-native'; import * as ReactNativeModules from 'react-native';`, snapshot: true }, - { - title: 'import from "react-native"', - code: `import ReactNative from 'react-native'; -import { View } from 'react-native'; -import { Invalid, View as MyView } from 'react-native'; -import * as ReactNativeModules from 'react-native';`, - snapshot: true, - pluginOptions: { commonjs: true } - }, { title: 'import from "react-native-web"', code: `import { unstable_createElement } from 'react-native-web'; @@ -48,14 +39,6 @@ const { View } = require('react-native'); const { StyleSheet, Pressable } = require('react-native');`, snapshot: true }, - { - title: 'require "react-native"', - code: `const ReactNative = require('react-native'); -const { View } = require('react-native'); -const { StyleSheet, Pressable } = require('react-native');`, - snapshot: true, - pluginOptions: { commonjs: true } - }, { title: 'require "react-native-web"', code: `const ReactNative = require('react-native-web'); diff --git a/packages/babel-plugin-react-native-web/src/index.js b/packages/babel-plugin-react-native-web/src/index.js index 17230a85ab..f028aa15ce 100644 --- a/packages/babel-plugin-react-native-web/src/index.js +++ b/packages/babel-plugin-react-native-web/src/index.js @@ -1,15 +1,12 @@ const moduleMap = require('./moduleMap'); -const isCommonJS = (opts) => opts.commonjs === true; - -const getDistLocation = (importName, opts) => { - const format = isCommonJS(opts) ? 'cjs/' : ''; +const getDistLocation = (importName) => { const internalName = importName === 'unstable_createElement' ? 'createElement' : importName; if (internalName === 'index') { - return `react-native-web/dist/${format}index`; + return 'react-native-web/dist/index.js'; } else if (internalName && moduleMap[internalName]) { - return `react-native-web/dist/${format}exports/${internalName}`; + return `react-native-web/dist/exports/${internalName}/index.js`; } }; @@ -39,14 +36,14 @@ module.exports = function ({ types: t }) { return { name: 'Rewrite react-native to react-native-web', visitor: { - ImportDeclaration(path, state) { + ImportDeclaration(path) { const { specifiers } = path.node; if (isReactNativeModule(path.node)) { const imports = specifiers .map((specifier) => { if (t.isImportSpecifier(specifier)) { const importName = specifier.imported.name; - const distLocation = getDistLocation(importName, state.opts); + const distLocation = getDistLocation(importName); if (distLocation) { return t.importDeclaration( @@ -61,7 +58,7 @@ module.exports = function ({ types: t }) { } return t.importDeclaration( [specifier], - t.stringLiteral(getDistLocation('index', state.opts)) + t.stringLiteral(getDistLocation('index')) ); }) .filter(Boolean); @@ -69,7 +66,7 @@ module.exports = function ({ types: t }) { path.replaceWithMultiple(imports); } }, - ExportNamedDeclaration(path, state) { + ExportNamedDeclaration(path) { const { specifiers } = path.node; if (isReactNativeModule(path.node)) { const exports = specifiers @@ -77,7 +74,7 @@ module.exports = function ({ types: t }) { if (t.isExportSpecifier(specifier)) { const exportName = specifier.exported.name; const localName = specifier.local.name; - const distLocation = getDistLocation(localName, state.opts); + const distLocation = getDistLocation(localName); if (distLocation) { return t.exportNamedDeclaration( @@ -95,7 +92,7 @@ module.exports = function ({ types: t }) { return t.exportNamedDeclaration( null, [specifier], - t.stringLiteral(getDistLocation('index', state.opts)) + t.stringLiteral(getDistLocation('index')) ); }) .filter(Boolean); @@ -103,16 +100,13 @@ module.exports = function ({ types: t }) { path.replaceWithMultiple(exports); } }, - VariableDeclaration(path, state) { + VariableDeclaration(path) { if (isReactNativeRequire(t, path.node)) { const { id } = path.node.declarations[0]; if (t.isObjectPattern(id)) { const imports = id.properties .map((identifier) => { - const distLocation = getDistLocation( - identifier.key.name, - state.opts - ); + const distLocation = getDistLocation(identifier.key.name); if (distLocation) { return t.variableDeclaration(path.node.kind, [ t.variableDeclarator( @@ -136,7 +130,7 @@ module.exports = function ({ types: t }) { t.variableDeclarator( t.identifier(name), t.callExpression(t.identifier('require'), [ - t.stringLiteral(getDistLocation('index', state.opts)) + t.stringLiteral(getDistLocation('index')) ]) ) ]); diff --git a/packages/benchmarks/package.json b/packages/benchmarks/package.json index f63af6bc99..294673d750 100644 --- a/packages/benchmarks/package.json +++ b/packages/benchmarks/package.json @@ -2,6 +2,7 @@ "private": true, "name": "benchmarks", "version": "0.0.0", + "type": "module", "scripts": { "clean": "del-cli ./dist", "build": "NODE_ENV=production npm run dev", diff --git a/packages/benchmarks/webpack.config.js b/packages/benchmarks/webpack.config.js index c8a583fbc8..0c85b79611 100644 --- a/packages/benchmarks/webpack.config.js +++ b/packages/benchmarks/webpack.config.js @@ -1,12 +1,11 @@ -const BundleAnalyzerPlugin = - require('webpack-bundle-analyzer').BundleAnalyzerPlugin; -const path = require('path'); +import path from 'node:path'; +import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; -const appDirectory = path.resolve(__dirname); +const appDirectory = import.meta.dirname; -module.exports = { +export default { mode: 'production', - context: __dirname, + context: appDirectory, entry: './src/index', output: { path: path.resolve(appDirectory, 'dist'), @@ -39,7 +38,7 @@ module.exports = { loader: 'babel-loader', options: { cacheDirectory: false, - extends: path.resolve(appDirectory, '../../babel.config') + extends: path.resolve(appDirectory, '../../babel.config.js') } } } diff --git a/packages/dom-event-testing-library/package.json b/packages/dom-event-testing-library/package.json index c1f73c770a..84e16707a1 100644 --- a/packages/dom-event-testing-library/package.json +++ b/packages/dom-event-testing-library/package.json @@ -4,6 +4,7 @@ "version": "0.0.0", "main": "src/index.js", "description": "Browser event sequences for unit tests", + "type": "module", "author": "Nicolas Gallagher", "license": "MIT", "homepage": "https://github.com/necolas/react-native-web/tree/master/packages/dom-event-testing-library" diff --git a/packages/react-native-web-docs/eleventy.config.js b/packages/react-native-web-docs/eleventy.config.js index 9f33012be3..fca9f47c7e 100644 --- a/packages/react-native-web-docs/eleventy.config.js +++ b/packages/react-native-web-docs/eleventy.config.js @@ -1,20 +1,18 @@ -'use strict'; - -const csso = require('csso'); -const eleventyNavigationPlugin = require('@11ty/eleventy-navigation'); -const eleventySvgContentsPlugin = require('eleventy-plugin-svg-contents'); -const eleventySyntaxHighlightPlugin = require('@11ty/eleventy-plugin-syntaxhighlight'); -const htmlmin = require('html-minifier-terser'); -const markdown = require('markdown-it'); -const markdownAnchor = require('markdown-it-anchor'); -const markdownAttrs = require('markdown-it-attrs'); -const markdownContainer = require('markdown-it-container'); -const markdownEmoji = require('markdown-it-emoji'); -const markdownFootnote = require('markdown-it-footnote'); -const markdownTasks = require('markdown-it-task-lists'); -const terser = require('terser'); - -module.exports = function (eleventyConfig) { +import eleventyNavigationPlugin from '@11ty/eleventy-navigation'; +import eleventySyntaxHighlightPlugin from '@11ty/eleventy-plugin-syntaxhighlight'; +import * as csso from 'csso'; +import eleventySvgContentsPlugin from 'eleventy-plugin-svg-contents'; +import htmlmin from 'html-minifier-terser'; +import markdown from 'markdown-it'; +import markdownAnchor from 'markdown-it-anchor'; +import markdownAttrs from 'markdown-it-attrs'; +import markdownContainer from 'markdown-it-container'; +import * as markdownEmoji from 'markdown-it-emoji'; +import markdownFootnote from 'markdown-it-footnote'; +import markdownTasks from 'markdown-it-task-lists'; +import * as terser from 'terser'; + +export default function (eleventyConfig) { // Merge data instead of overriding // https://www.11ty.dev/docs/data-deep-merge/ eleventyConfig.setDataDeepMerge(true); @@ -156,4 +154,4 @@ module.exports = function (eleventyConfig) { // Matches the GitHub Pages subdirectory of the site (necolas.github.io/react-native-web) pathPrefix: '/react-native-web/' }; -}; +} diff --git a/packages/react-native-web-docs/package.json b/packages/react-native-web-docs/package.json index e820c70d17..02c936e3bc 100644 --- a/packages/react-native-web-docs/package.json +++ b/packages/react-native-web-docs/package.json @@ -3,6 +3,7 @@ "name": "react-native-web-docs", "version": "0.21.4", "description": "Documentation website for React Native for Web", + "type": "module", "scripts": { "dev": "eleventy --serve", "build": "ELEVENTY_PRODUCTION=true eleventy", diff --git a/packages/react-native-web-docs/src/data/site.js b/packages/react-native-web-docs/src/data/site.js index 7847b376e9..2ee88f169f 100644 --- a/packages/react-native-web-docs/src/data/site.js +++ b/packages/react-native-web-docs/src/data/site.js @@ -1,6 +1,6 @@ -const packageJson = require('../../package.json'); +import packageJson from '../../package.json' with { type: 'json' }; -module.exports = { +export default { name: 'React Native for Web', description: '', footer: 'Copyright © Nicolas Gallagher and Meta Platforms, Inc.', diff --git a/packages/react-native-web-docs/src/pages/docs/getting-started/multi-platform.md b/packages/react-native-web-docs/src/pages/docs/getting-started/multi-platform.md index a19ab5a7ba..53c7a485f1 100644 --- a/packages/react-native-web-docs/src/pages/docs/getting-started/multi-platform.md +++ b/packages/react-native-web-docs/src/pages/docs/getting-started/multi-platform.md @@ -71,10 +71,10 @@ Create a `web/webpack.config.js` file: ```js // web/webpack.config.js -const path = require('path'); -const webpack = require('webpack'); +import path from 'node:path'; +import webpack from 'webpack'; -const appDirectory = path.resolve(__dirname, '../'); +const appDirectory = path.resolve(import.meta.dirname, '../'); // This is needed for webpack to compile JavaScript. // Many OSS React Native packages are not compiled to ES5 before being @@ -113,7 +113,7 @@ const imageLoaderConfiguration = { } }; -module.exports = { +export default { entry: [ // load any web API polyfills // path.resolve(appDirectory, 'polyfills-web.js'), diff --git a/packages/react-native-web-docs/src/pages/docs/getting-started/setup.md b/packages/react-native-web-docs/src/pages/docs/getting-started/setup.md index d074b9abbe..efb658b1f8 100644 --- a/packages/react-native-web-docs/src/pages/docs/getting-started/setup.md +++ b/packages/react-native-web-docs/src/pages/docs/getting-started/setup.md @@ -53,26 +53,19 @@ module.exports = { ### Jest -[Jest](https://facebook.github.io/jest/) can be configured to understand the aliased module. +[Jest](https://facebook.github.io/jest/) can be configured to understand the aliased module. The package is only published as ES modules, so Jest must also transform it. ```js { "moduleNameMapper": { "^react-native$": "react-native-web" - } + }, + "transformIgnorePatterns": [ + "/node_modules/(?!react-native-web/)" + ] } ``` -### Flow - -[Flow](https://flow.org) can be configured to understand the aliased module. - -```yml -[options] -# Alias the package name -module.name_mapper='^react-native$' -> 'react-native-web' -``` - ### Node.js Node.js can alias `react-native` to `react-native-web` using [`module-alias`](https://www.npmjs.com/package/module-alias). This is useful if you want to pre-render the app (e.g., server-side rendering or build-time rendering). @@ -80,9 +73,11 @@ Node.js can alias `react-native` to `react-native-web` using [`module-alias`](ht ```js // Install the `module-alias` package as a dependency first const moduleAlias = require('module-alias'); + moduleAlias.addAliases({ 'react-native': require.resolve('react-native-web') }); + moduleAlias(); ``` @@ -100,19 +95,6 @@ The project's Babel plugin (see [Installation]({{ '/docs/installation' | url }}) --- -## Types - -Flow can be configured to pull types from React Native for Web's source code. - -```yml -[options] -# Point flow to the 'module' field by default -module.system.node.main_field=module -module.system.node.main_field=main -``` - ---- - ## Root element Full-screen React Native apps with a root `` may require the following styles inlined in the HTML document shell. ([Example](https://codesandbox.io/s/52x1871vjl?file=/public/index.html:352-644).) diff --git a/packages/react-native-web-examples/.babelrc b/packages/react-native-web-examples/.babelrc index 84c19682c4..e39892d37f 100644 --- a/packages/react-native-web-examples/.babelrc +++ b/packages/react-native-web-examples/.babelrc @@ -1,4 +1,4 @@ { "presets": ["next/babel"], - "plugins": [["react-native-web", { "commonjs": true }]] + "plugins": ["react-native-web"] } diff --git a/packages/react-native-web-examples/next.config.js b/packages/react-native-web-examples/next.config.js index 29a8c30a1d..75ed7e3736 100644 --- a/packages/react-native-web-examples/next.config.js +++ b/packages/react-native-web-examples/next.config.js @@ -1,12 +1,14 @@ -const fs = require('fs'); -const path = require('path'); +import fs from 'node:fs'; +import path from 'node:path'; const pages = fs - .readdirSync(path.resolve(__dirname, 'pages'), { withFileTypes: true }) + .readdirSync(path.resolve(import.meta.dirname, 'pages'), { + withFileTypes: true + }) .filter((dirent) => dirent.isDirectory()) .map((dirent) => dirent.name); -module.exports = { +export default { env: { pages: JSON.stringify(pages) }, webpack: (config, options) => { config.resolve.alias['react-native'] = 'react-native-web'; diff --git a/packages/react-native-web-examples/package.json b/packages/react-native-web-examples/package.json index ac32a38139..0d331bdccb 100644 --- a/packages/react-native-web-examples/package.json +++ b/packages/react-native-web-examples/package.json @@ -2,6 +2,7 @@ "private": true, "name": "react-native-web-examples", "version": "0.21.4", + "type": "module", "scripts": { "build": "next build --webpack", "dev": "next dev --webpack", diff --git a/packages/react-native-web-examples/pages/_document.js b/packages/react-native-web-examples/pages/_document.js index 6b70de4bbb..82d7ad731f 100644 --- a/packages/react-native-web-examples/pages/_document.js +++ b/packages/react-native-web-examples/pages/_document.js @@ -1,25 +1,23 @@ -import Document, { Html, Head, Main, NextScript } from 'next/document'; +import { Html, Head, Main, NextScript } from 'next/document'; import { AppRegistry } from 'react-native'; -export default class MyDocument extends Document { - static async getInitialProps(ctx) { - const { renderPage } = ctx; - AppRegistry.registerComponent('rn', () => Main); - const { getStyleElement } = AppRegistry.getApplication('rn'); - const page = await renderPage(); - const styles = getStyleElement(); - return { ...page, styles }; - } - - render() { - return ( - - - -
- - - - ); - } +export default function MyDocument() { + return ( + + + +
+ + + + ); } + +MyDocument.getInitialProps = async (ctx) => { + const { renderPage } = ctx; + AppRegistry.registerComponent('rn', () => Main); + const { getStyleElement } = AppRegistry.getApplication('rn'); + const page = await renderPage(); + const styles = getStyleElement(); + return { ...page, styles }; +}; diff --git a/packages/react-native-web/asset-registry.js b/packages/react-native-web/asset-registry.js deleted file mode 100644 index 0add5ea2a1..0000000000 --- a/packages/react-native-web/asset-registry.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// TODO: move this to package.json:exports -// Metro uses this entrypoint to interact with the asset registry -module.exports = require('./dist/cjs/exports/AssetRegistry'); diff --git a/packages/react-native-web/package.json b/packages/react-native-web/package.json index 20bfc54cc0..87013b8d80 100644 --- a/packages/react-native-web/package.json +++ b/packages/react-native-web/package.json @@ -5,21 +5,23 @@ "name": "react-native-web", "version": "0.21.4", "description": "React Native for Web", - "module": "dist/index.js", - "main": "dist/cjs/index.js", + "type": "module", + "main": "dist/index.js", + "exports": { + ".": "./dist/index.js", + "./asset-registry": "./dist/exports/AssetRegistry/index.js", + "./dist/*": "./dist/*", + "./package.json": "./package.json" + }, "sideEffects": false, "files": [ "dist", - "src", - "asset-registry.js", "!**/__tests__" ], "scripts": { "clean": "del-cli ./dist", - "build": "npm-run-all clean -p \"build:* {@}\" --", - "build:commonjs": "cross-env BABEL_ENV=commonjs babel src --root-mode upward --out-dir dist/cjs --ignore \"**/__tests__\"", - "build:es": "babel src --root-mode upward --out-dir dist --ignore \"**/__tests__\"", - "dev": "npm-run-all clean -p \"build:* {@} -- --watch\"" + "build": "npm run clean && babel src --root-mode upward --out-dir dist --ignore \"**/__tests__\"", + "dev": "npm run clean && babel src --root-mode upward --out-dir dist --ignore \"**/__tests__\" --watch" }, "dependencies": { "@react-native/normalize-colors": "^0.88.0", diff --git a/packages/react-native-web/src/exports/AssetRegistry/index.js b/packages/react-native-web/src/exports/AssetRegistry/index.js index 4ba24485d8..7e9c56abc3 100644 --- a/packages/react-native-web/src/exports/AssetRegistry/index.js +++ b/packages/react-native-web/src/exports/AssetRegistry/index.js @@ -13,11 +13,11 @@ import type { PackagerAsset } from '../../modules/AssetRegistry'; import { registerAsset, getAssetByID } from '../../modules/AssetRegistry'; -const AssetRegistry = { +export default { registerAsset, getAssetByID }; -export default AssetRegistry; +export { registerAsset, getAssetByID }; export type { PackagerAsset }; diff --git a/packages/react-native-web/src/exports/Image/__tests__/index-test.js b/packages/react-native-web/src/exports/Image/__tests__/index-test.js index 065730e6bb..c6c62f55e7 100644 --- a/packages/react-native-web/src/exports/Image/__tests__/index-test.js +++ b/packages/react-native-web/src/exports/Image/__tests__/index-test.js @@ -7,7 +7,7 @@ /* eslint-disable react/jsx-no-bind */ -import * as AssetRegistry from '../../../modules/AssetRegistry'; +import { registerAsset } from '../../../modules/AssetRegistry'; import Image from '../'; import ImageLoader, { ImageUriCache } from '../../../modules/ImageLoader'; import PixelRatio from '../../PixelRatio'; @@ -321,22 +321,22 @@ describe('components/Image', () => { }); test('it correctly selects the source scale', () => { - AssetRegistry.getAssetByID = jest.fn(() => ({ + const assetId = registerAsset({ httpServerLocation: 'static', name: 'img', scales: [1, 2, 3], type: 'png' - })); + }); PixelRatio.get = jest.fn(() => 1.0); - let { container } = render(); + let { container } = render(); expect(container.querySelector('img').src).toBe( 'http://localhost/static/img.png' ); act(() => { PixelRatio.get = jest.fn(() => 2.2); - ({ container } = render()); + ({ container } = render()); }); expect(container.querySelector('img').src).toBe( 'http://localhost/static/img@2x.png' diff --git a/packages/react-native-web/src/exports/Linking/__tests__/index-test.js b/packages/react-native-web/src/exports/Linking/__tests__/index-test.js index afba3983c9..9b366a5f2d 100644 --- a/packages/react-native-web/src/exports/Linking/__tests__/index-test.js +++ b/packages/react-native-web/src/exports/Linking/__tests__/index-test.js @@ -1,5 +1,3 @@ -/* eslint-env jasmine, jest */ - import Linking from '..'; describe('apis/Linking', () => { diff --git a/packages/react-native-web/src/modules/AssetRegistry/index.js b/packages/react-native-web/src/modules/AssetRegistry/index.js index e985b577fc..69d1ec492d 100644 --- a/packages/react-native-web/src/modules/AssetRegistry/index.js +++ b/packages/react-native-web/src/modules/AssetRegistry/index.js @@ -19,18 +19,7 @@ export type PackagerAsset = { type: string }; -// React Native Web exposes both CJS and ESM versions. -// This avoids duplicating the registry itself, returning the same data through either CJS or ESM. -const ASSET_REGISTRY = Symbol.for('react-native-web.AssetRegistry'); - -// $FlowFixMe[prop-missing] `globalThis` cannot be augmented -if (!globalThis[ASSET_REGISTRY]) { - // $FlowFixMe[prop-missing] `globalThis` cannot be augmented - globalThis[ASSET_REGISTRY] = []; -} - -// $FlowFixMe[prop-missing] `globalThis` cannot be augmented -const assets: Array = globalThis[ASSET_REGISTRY]; +const assets: Array = []; export function registerAsset(asset: PackagerAsset): number { // `push` returns new array length, so the first asset will diff --git a/packages/react-native-web/src/modules/InteractionManager/__tests__/TaskQueue-test.js b/packages/react-native-web/src/modules/InteractionManager/__tests__/TaskQueue-test.js index c1df7dcf0a..4ee6167b62 100644 --- a/packages/react-native-web/src/modules/InteractionManager/__tests__/TaskQueue-test.js +++ b/packages/react-native-web/src/modules/InteractionManager/__tests__/TaskQueue-test.js @@ -25,9 +25,9 @@ describe('TaskQueue', () => { }); } - beforeEach(() => { + beforeEach(async () => { jest.resetModules(); - const TaskQueue = require('../TaskQueue'); + const TaskQueue = (await import('../TaskQueue.js')).default; taskQueue = new TaskQueue(); sequenceId = 0; }); diff --git a/packages/react-native-web/src/modules/InteractionManager/__tests__/index-test.js b/packages/react-native-web/src/modules/InteractionManager/__tests__/index-test.js index 73a460cb25..fd747ccf43 100644 --- a/packages/react-native-web/src/modules/InteractionManager/__tests__/index-test.js +++ b/packages/react-native-web/src/modules/InteractionManager/__tests__/index-test.js @@ -12,9 +12,9 @@ function expectToHaveBeenCalledOnce(fn) { describe('InteractionManager', () => { let InteractionManager; - beforeEach(() => { + beforeEach(async () => { jest.resetModules(); - InteractionManager = require('..'); + InteractionManager = (await import('../index.js')).default; }); it('run tasks asynchronously when there are interactions', () => { diff --git a/scripts/createBabelReactNativeWebModuleMap.js b/scripts/createBabelReactNativeWebModuleMap.js deleted file mode 100644 index d0910e8be4..0000000000 --- a/scripts/createBabelReactNativeWebModuleMap.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Creates a map of exported modules, allowing the RNW babel plugin to rewrite - * paths only for modules it knows are exported by RNW. - */ -const fs = require('fs'); -const path = require('path'); - -const isDirectory = (source) => fs.lstatSync(source).isDirectory(); -const getDirectories = (source) => - fs.readdirSync(source).filter((name) => isDirectory(path.join(source, name))); - -const packagesDir = path.join(__dirname, '../packages/'); -const exportsDir = path.join(packagesDir, 'react-native-web/src/exports'); -const moduleMapOutfile = path.join( - packagesDir, - 'babel-plugin-react-native-web/src/moduleMap.js' -); - -const moduleMap = getDirectories(exportsDir).reduce((acc, curr) => { - acc[curr] = true; - return acc; -}, {}); - -const data = `// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. -module.exports = ${JSON.stringify(moduleMap, null, 2)}`; - -fs.writeFileSync(moduleMapOutfile, data); diff --git a/scripts/createModuleMap.js b/scripts/createModuleMap.js new file mode 100644 index 0000000000..411cd94f28 --- /dev/null +++ b/scripts/createModuleMap.js @@ -0,0 +1,51 @@ +/** + * Creates a map of exported modules, allowing the RNW babel plugin to rewrite + * paths only for modules it knows are exported by RNW. + * + * By default, exits with an error if the file is not up to date. + * With --write, updates the file. + */ +import fs from 'node:fs'; +import path from 'node:path'; + +const isDirectory = (source) => fs.lstatSync(source).isDirectory(); + +const getDirectories = (source) => + fs.readdirSync(source).filter((name) => isDirectory(path.join(source, name))); + +const packagesDir = path.join(import.meta.dirname, '../packages/'); +const exportsDir = path.join(packagesDir, 'react-native-web/src/exports'); +const identifierRegex = /^[A-Za-z_$][\w$]*$/; + +const moduleMapOutfile = path.join( + packagesDir, + 'babel-plugin-react-native-web/src/moduleMap.js' +); + +const moduleMapEntries = getDirectories(exportsDir) + .map((name) => { + return ` ${ + identifierRegex.test(name) ? name : `'${name.replace(/[\\']/g, '\\$&')}'` + }: true`; + }) + .join(',\n'); + +const moduleMapData = `// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +module.exports = { +${moduleMapEntries} +}; +`; + +if (process.argv.includes('--write')) { + fs.writeFileSync(moduleMapOutfile, moduleMapData); +} else if ( + !fs.existsSync(moduleMapOutfile) || + fs.readFileSync(moduleMapOutfile, 'utf-8') !== moduleMapData +) { + console.error( + `${path.relative(process.cwd(), moduleMapOutfile)} is not up to date.` + ); + + console.error('Run `npm run module-map` and stage the changes.'); + process.exit(1); +} diff --git a/scripts/releaseReactNativeWebPackages.js b/scripts/releasePackages.js similarity index 80% rename from scripts/releaseReactNativeWebPackages.js rename to scripts/releasePackages.js index 7edf80c94b..017735fe48 100644 --- a/scripts/releaseReactNativeWebPackages.js +++ b/scripts/releasePackages.js @@ -1,11 +1,10 @@ #!/usr/bin/env node -'use strict'; - -const { execSync } = require('node:child_process'); -const fs = require('node:fs'); -const path = require('node:path'); -const { parseArgs } = require('node:util'); +import { execSync } from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; +import { parseArgs } from 'node:util'; +import packageJson from '../package.json' with { type: 'json' }; const { positionals, values } = parseArgs({ allowPositionals: true, @@ -34,19 +33,16 @@ try { console.log(`Publishing react-native-web@${version}`); // Collect 'react-native-web' workspaces and package manifests -const workspacePaths = require('../package.json').workspaces.reduce( - (acc, w) => { - const resolvedPaths = fs.globSync(w); - resolvedPaths.forEach((p) => { - // Remove duplicates and unrelated packages - if (p.includes('react-native-web') && acc.indexOf(p) === -1) { - acc.push(p); - } - }); - return acc; - }, - [] -); +const workspacePaths = packageJson.workspaces.reduce((acc, w) => { + const resolvedPaths = fs.globSync(w); + resolvedPaths.forEach((p) => { + // Remove duplicates and unrelated packages + if (p.includes('react-native-web') && acc.indexOf(p) === -1) { + acc.push(p); + } + }); + return acc; +}, []); const workspaces = workspacePaths.map((dir) => { const directory = path.resolve(dir);