diff --git a/.changeset/brown-bobcats-remain.md b/.changeset/brown-bobcats-remain.md index 53bf8f394..176da98ce 100644 --- a/.changeset/brown-bobcats-remain.md +++ b/.changeset/brown-bobcats-remain.md @@ -2,4 +2,4 @@ "@onflow/fcl-bundle": minor --- -Add tailwindcss support, preact support, image loading support +Add `rollup-plugin-postcss` & `@rollup/plugin-image` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ff9b87bb4..af8a5795f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,10 +56,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.25.7", - "license": "MIT", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dependencies": { - "@babel/highlight": "^7.25.7", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" }, "engines": { @@ -102,10 +104,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.25.7", - "license": "MIT", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.2.tgz", + "integrity": "sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==", "dependencies": { - "@babel/types": "^7.25.7", + "@babel/parser": "^7.26.2", + "@babel/types": "^7.26.0", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -115,10 +119,11 @@ } }, "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", "dependencies": { - "@babel/types": "^7.25.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -220,11 +225,12 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dependencies": { - "@babel/traverse": "^7.25.7", - "@babel/types": "^7.25.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -257,8 +263,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "engines": { "node": ">=6.9.0" } @@ -316,15 +323,17 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "engines": { "node": ">=6.9.0" } @@ -362,6 +371,7 @@ "node_modules/@babel/highlight": { "version": "7.25.7", "license": "MIT", + "peer": true, "dependencies": { "@babel/helper-validator-identifier": "^7.25.7", "chalk": "^2.4.2", @@ -373,10 +383,11 @@ } }, "node_modules/@babel/parser": { - "version": "7.25.8", - "license": "MIT", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", + "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", "dependencies": { - "@babel/types": "^7.25.8" + "@babel/types": "^7.26.0" }, "bin": { "parser": "bin/babel-parser.js" @@ -763,10 +774,11 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", + "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", "dependencies": { - "@babel/helper-plugin-utils": "^7.25.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1446,14 +1458,15 @@ } }, "node_modules/@babel/plugin-transform-react-jsx": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.25.9.tgz", + "integrity": "sha512-s5XwpQYCqGerXl+Pu6VDL3x0j2d82eiV77UJ8a2mDHAW7j9SWRqQ2y1fNo1Z74CdcYipl5Z41zvjj4Nfzq36rw==", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.25.7", - "@babel/helper-module-imports": "^7.25.7", - "@babel/helper-plugin-utils": "^7.25.7", - "@babel/plugin-syntax-jsx": "^7.25.7", - "@babel/types": "^7.25.7" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/plugin-syntax-jsx": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1903,26 +1916,28 @@ } }, "node_modules/@babel/template": { - "version": "7.25.7", - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "dependencies": { - "@babel/code-frame": "^7.25.7", - "@babel/parser": "^7.25.7", - "@babel/types": "^7.25.7" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.25.7", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.25.7", - "@babel/generator": "^7.25.7", - "@babel/parser": "^7.25.7", - "@babel/template": "^7.25.7", - "@babel/types": "^7.25.7", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.9.tgz", + "integrity": "sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==", + "dependencies": { + "@babel/code-frame": "^7.25.9", + "@babel/generator": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/template": "^7.25.9", + "@babel/types": "^7.25.9", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1931,12 +1946,12 @@ } }, "node_modules/@babel/types": { - "version": "7.25.8", - "license": "MIT", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", + "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", "dependencies": { - "@babel/helper-string-parser": "^7.25.7", - "@babel/helper-validator-identifier": "^7.25.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -8730,52 +8745,6 @@ } } }, - "node_modules/@rollup/plugin-url": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-url/-/plugin-url-8.0.2.tgz", - "integrity": "sha512-5yW2LP5NBEgkvIRSSEdJkmxe5cUNZKG3eenKtfJvSkxVm/xTTu7w+ayBtNwhozl1ZnTUCU0xFaRQR+cBl2H7TQ==", - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "make-dir": "^3.1.0", - "mime": "^3.0.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-url/node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@rollup/plugin-url/node_modules/mime": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", - "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/@rollup/pluginutils": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.2.tgz", @@ -10427,6 +10396,7 @@ "node_modules/ansi-styles": { "version": "3.2.1", "license": "MIT", + "peer": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -11622,6 +11592,7 @@ "node_modules/chalk": { "version": "2.4.2", "license": "MIT", + "peer": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -11986,13 +11957,15 @@ "node_modules/color-convert": { "version": "1.9.3", "license": "MIT", + "peer": true, "dependencies": { "color-name": "1.1.3" } }, "node_modules/color-name": { "version": "1.1.3", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/color-support": { "version": "1.1.3", @@ -15777,6 +15750,7 @@ "node_modules/has-flag": { "version": "3.0.0", "license": "MIT", + "peer": true, "engines": { "node": ">=4" } @@ -26913,6 +26887,7 @@ "node_modules/supports-color": { "version": "5.5.0", "license": "MIT", + "peer": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -27485,13 +27460,6 @@ "version": "1.0.5", "license": "BSD-3-Clause" }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "license": "MIT", @@ -29132,9 +29100,6 @@ "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-replace": "^6.0.1", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-url": "^8.0.2", - "@rollup/pluginutils": "^5.1.2", - "@rollup/rollup-linux-x64-gnu": "*", "commander": "^12.1.0", "lodash": "^4.17.21", "rollup": "^4.24.0", @@ -29280,6 +29245,7 @@ "devDependencies": { "@babel/plugin-proposal-decorators": "^7.25.7", "@babel/plugin-syntax-decorators": "^7.25.7", + "@babel/plugin-transform-react-jsx": "^7.25.9", "@babel/preset-typescript": "^7.25.7", "@onflow/fcl-bundle": "1.5.1-alpha.0", "eslint": "^8.57.1", diff --git a/packages/fcl-bundle/.babelrc b/packages/fcl-bundle/.babelrc index 344d6d61c..63566c459 100644 --- a/packages/fcl-bundle/.babelrc +++ b/packages/fcl-bundle/.babelrc @@ -1,3 +1,3 @@ { "presets": [["@babel/preset-env"]] -} +} \ No newline at end of file diff --git a/packages/fcl-bundle/package.json b/packages/fcl-bundle/package.json index e73b775d9..dad05c20d 100644 --- a/packages/fcl-bundle/package.json +++ b/packages/fcl-bundle/package.json @@ -22,8 +22,6 @@ "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-replace": "^6.0.1", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-url": "^8.0.2", - "@rollup/pluginutils": "^5.1.2", "commander": "^12.1.0", "lodash": "^4.17.21", "rollup": "^4.24.0", diff --git a/packages/fcl-bundle/src/build/get-input-options.js b/packages/fcl-bundle/src/build/get-input-options.js index 64e2439b8..405fb638c 100644 --- a/packages/fcl-bundle/src/build/get-input-options.js +++ b/packages/fcl-bundle/src/build/get-input-options.js @@ -10,15 +10,10 @@ const {nodeResolve} = require("@rollup/plugin-node-resolve") const {babel} = require("@rollup/plugin-babel") const terser = require("@rollup/plugin-terser") const typescript = require("rollup-plugin-typescript2") -const rawPlugin = require("../plugins/raw-plugin") const postcss = require("rollup-plugin-postcss") const imagePlugin = require("@rollup/plugin-image") const {DEFAULT_EXTENSIONS} = require("@babel/core") -const tailwindcss = require("tailwindcss") - -const {getPackageRoot} = require("../util") - const SUPPRESSED_WARNING_CODES = [ "MISSING_GLOBAL_NAME", "MISSING_NODE_BUILTINS", @@ -76,14 +71,6 @@ module.exports = function getInputOptions(package, build) { ".png", ]) - const tailwindConfigPath = path.resolve( - getPackageRoot(), - "tailwind.config.js" - ) - const tailwindConfig = fs.existsSync(tailwindConfigPath) - ? require(tailwindConfigPath) - : null - let options = { input: build.source, external: testExternal, @@ -99,12 +86,12 @@ module.exports = function getInputOptions(package, build) { resolveOnly, extensions, }), - tailwindConfig + fs.existsSync("postcss.config.js") ? postcss({ inject: false, extensions: [".css"], minimize: true, - plugins: [tailwindcss(tailwindConfig)], + config: true, }) : null, commonjs(), @@ -138,13 +125,6 @@ module.exports = function getInputOptions(package, build) { version: babelRuntimeVersion, }, ], - [ - "@babel/plugin-transform-react-jsx", - { - importSource: "preact", - runtime: "automatic", - }, - ], ], sourceMaps: true, extensions, diff --git a/packages/fcl-bundle/src/plugins/raw-plugin.js b/packages/fcl-bundle/src/plugins/raw-plugin.js deleted file mode 100644 index fb188739b..000000000 --- a/packages/fcl-bundle/src/plugins/raw-plugin.js +++ /dev/null @@ -1,39 +0,0 @@ -const {createFilter} = require("@rollup/pluginutils") - -module.exports = function rawPlugin() { - const filter = createFilter(["**/*?raw"]) // Match files ending with ?raw - - const rawList = [] - return { - name: "raw-suffix-plugin", - - // Use `resolveId` to handle the ?raw suffix - resolveId(source, importer) { - if (filter(source)) { - // Strip ?raw, and let other plugins (like node-resolve) handle the resolution - const actualSource = source.replace("?raw", "") - return this.resolve(actualSource, importer, {skipSelf: true}).then( - resolved => { - // Append ?raw back after resolution - if (resolved) { - rawList.push(resolved.id) - return `${resolved.id}` - } - return null - } - ) - } - return null // Allow other plugins to resolve other files - }, - transform(code, id) { - // Only transform files that match the filter - if (!rawList.includes(id)) return null - - // Return the raw code directly as a JavaScript object - return { - code: `export default ${JSON.stringify(code)}`, - map: {mappings: ""}, - } - }, - } -} diff --git a/packages/fcl-wc/.babelrc b/packages/fcl-wc/.babelrc index 1a42da146..5ff514bd4 100644 --- a/packages/fcl-wc/.babelrc +++ b/packages/fcl-wc/.babelrc @@ -10,8 +10,11 @@ ], "plugins": [ [ - "@babel/plugin-proposal-decorators", - {"version": "2023-11", "decoratorsBeforeExport": true} + "@babel/plugin-transform-react-jsx", + { + "importSource": "preact", + "runtime": "automatic" + } ] ] } diff --git a/packages/fcl-wc/package.json b/packages/fcl-wc/package.json index f5ca60def..6a79f7d6c 100644 --- a/packages/fcl-wc/package.json +++ b/packages/fcl-wc/package.json @@ -30,6 +30,7 @@ "devDependencies": { "@babel/plugin-proposal-decorators": "^7.25.7", "@babel/plugin-syntax-decorators": "^7.25.7", + "@babel/plugin-transform-react-jsx": "^7.25.9", "@babel/preset-typescript": "^7.25.7", "@onflow/fcl-bundle": "1.5.1-alpha.0", "eslint": "^8.57.1", diff --git a/packages/fcl-wc/postcss.config.js b/packages/fcl-wc/postcss.config.js new file mode 100644 index 000000000..d5ec97615 --- /dev/null +++ b/packages/fcl-wc/postcss.config.js @@ -0,0 +1,8 @@ +const tailwindcss = require('tailwindcss'); +const tailwindConfig = require('./tailwind.config.js'); + +module.exports = { + plugins: [ + tailwindcss(tailwindConfig), + ], +}; \ No newline at end of file