diff --git a/packages/commonjs/CHANGELOG.md b/packages/commonjs/CHANGELOG.md index 322a3e90d..36f5cc402 100644 --- a/packages/commonjs/CHANGELOG.md +++ b/packages/commonjs/CHANGELOG.md @@ -1,5 +1,13 @@ # @rollup/plugin-commonjs ChangeLog +## v28.0.1 + +_2024-10-16_ + +### Updates + +- chore: upgrade picomatch (#1775) + ## v28.0.0 _2024-09-23_ diff --git a/packages/commonjs/package.json b/packages/commonjs/package.json index abc133e92..6a2d29369 100644 --- a/packages/commonjs/package.json +++ b/packages/commonjs/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/plugin-commonjs", - "version": "28.0.0", + "version": "28.0.1", "publishConfig": { "access": "public" }, @@ -72,10 +72,10 @@ "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", "estree-walker": "^2.0.2", - "fdir": "^6.1.1", + "fdir": "^6.2.0", "is-reference": "1.2.1", "magic-string": "^0.30.3", - "picomatch": "^2.3.1" + "picomatch": "^4.0.2" }, "devDependencies": { "@rollup/plugin-json": "^5.0.0", diff --git a/packages/dynamic-import-vars/CHANGELOG.md b/packages/dynamic-import-vars/CHANGELOG.md index 660134aa5..835d6e1ff 100644 --- a/packages/dynamic-import-vars/CHANGELOG.md +++ b/packages/dynamic-import-vars/CHANGELOG.md @@ -1,5 +1,13 @@ # @rollup/plugin-dynamic-import-vars ChangeLog +## v2.1.4 + +_2024-10-16_ + +### Updates + +- chore: switch to tinyglobby for fewer dependencies (#1780) + ## v2.1.3 _2024-09-22_ diff --git a/packages/dynamic-import-vars/package.json b/packages/dynamic-import-vars/package.json index ce88fe913..359a55212 100644 --- a/packages/dynamic-import-vars/package.json +++ b/packages/dynamic-import-vars/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/plugin-dynamic-import-vars", - "version": "2.1.3", + "version": "2.1.4", "publishConfig": { "access": "public" }, @@ -73,8 +73,8 @@ "@rollup/pluginutils": "^5.0.1", "astring": "^1.8.5", "estree-walker": "^2.0.2", - "fast-glob": "^3.2.12", - "magic-string": "^0.30.3" + "magic-string": "^0.30.3", + "tinyglobby": "^0.2.8" }, "devDependencies": { "acorn": "^8.8.0", diff --git a/packages/dynamic-import-vars/src/dynamic-import-to-glob.js b/packages/dynamic-import-vars/src/dynamic-import-to-glob.js index ed1ae978e..de63b90b1 100644 --- a/packages/dynamic-import-vars/src/dynamic-import-to-glob.js +++ b/packages/dynamic-import-vars/src/dynamic-import-to-glob.js @@ -1,6 +1,6 @@ import path from 'path'; -import fastGlob from 'fast-glob'; +import { escapePath } from 'tinyglobby'; export class VariableDynamicImportError extends Error {} @@ -12,7 +12,7 @@ function sanitizeString(str) { if (str.includes('*')) { throw new VariableDynamicImportError('A dynamic import cannot contain * characters.'); } - return fastGlob.escapePath(str); + return escapePath(str); } function templateLiteralToGlob(node) { diff --git a/packages/dynamic-import-vars/src/index.js b/packages/dynamic-import-vars/src/index.js index b44770c45..3351a1582 100644 --- a/packages/dynamic-import-vars/src/index.js +++ b/packages/dynamic-import-vars/src/index.js @@ -2,7 +2,7 @@ import path from 'path'; import { walk } from 'estree-walker'; import MagicString from 'magic-string'; -import fastGlob from 'fast-glob'; +import { globSync } from 'tinyglobby'; import { generate } from 'astring'; import { createFilter } from '@rollup/pluginutils'; @@ -50,7 +50,7 @@ function dynamicImportVariables({ include, exclude, warnOnError, errorWhenNoFile } // execute the glob - const result = fastGlob.sync(glob, { cwd: path.dirname(id) }); + const result = globSync(glob, { cwd: path.dirname(id), expandDirectories: false }); const paths = result.map((r) => r.startsWith('./') || r.startsWith('../') ? r : `./${r}` ); diff --git a/packages/typescript/CHANGELOG.md b/packages/typescript/CHANGELOG.md index e37cd8d34..cee7c0b14 100644 --- a/packages/typescript/CHANGELOG.md +++ b/packages/typescript/CHANGELOG.md @@ -1,5 +1,13 @@ # @rollup/plugin-typescript ChangeLog +## v12.1.1 + +_2024-10-16_ + +### Bugfixes + +- fix: allow for files to be nested in folders within outDir (#1783) + ## v12.1.0 _2024-09-22_ diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 6fd8b0232..cb6e3aeb0 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/plugin-typescript", - "version": "12.1.0", + "version": "12.1.1", "publishConfig": { "access": "public" }, diff --git a/packages/typescript/src/options/validate.ts b/packages/typescript/src/options/validate.ts index d0f22e3de..ae53834a3 100644 --- a/packages/typescript/src/options/validate.ts +++ b/packages/typescript/src/options/validate.ts @@ -58,13 +58,16 @@ export function validatePaths( for (const dirProperty of DIRECTORY_PROPS) { if (compilerOptions[dirProperty] && outputDir) { // Checks if the given path lies within Rollup output dir - const fromRollupDirToTs = relative(outputDir, compilerOptions[dirProperty]!); - if (fromRollupDirToTs.startsWith('..')) { - if (outputOptions.dir) { + if (outputOptions.dir) { + const fromRollupDirToTs = relative(outputDir, compilerOptions[dirProperty]!); + if (fromRollupDirToTs.startsWith('..')) { context.error( `@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside Rollup 'dir' option.` ); - } else { + } + } else { + const fromTsDirToRollup = relative(compilerOptions[dirProperty]!, outputDir); + if (fromTsDirToRollup.startsWith('..')) { context.error( `@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside the same directory as the Rollup 'file' option.` ); diff --git a/packages/typescript/test/test.js b/packages/typescript/test/test.js index efed9b397..e0b83fd0d 100644 --- a/packages/typescript/test/test.js +++ b/packages/typescript/test/test.js @@ -129,6 +129,36 @@ test.serial( } ); +test.serial( + 'ensures output files can be written to subdirectories within the tsconfig outDir', + async (t) => { + const warnings = []; + const outputOpts = { format: 'es', file: 'fixtures/basic/dist/esm/main.js' }; + const bundle = await rollup({ + input: 'fixtures/basic/main.ts', + output: outputOpts, + plugins: [ + typescript({ + tsconfig: 'fixtures/basic/tsconfig.json', + outDir: 'fixtures/basic/dist' + }) + ], + onwarn(warning) { + warnings.push(warning); + } + }); + + // This should not throw an error + const output = await getFiles(bundle, outputOpts); + + t.deepEqual( + output.map((out) => out.fileName), + ['fixtures/basic/dist/esm/main.js'] + ); + t.is(warnings.length, 0); + } +); + test.serial('ensures multiple outputs can be built', async (t) => { // In a rollup.config.js we would pass an array // The rollup method that's exported as a library won't do that so we must make two calls diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 66a7d6c92..3d2776de6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -206,8 +206,8 @@ importers: specifier: ^2.0.2 version: 2.0.2 fdir: - specifier: ^6.1.1 - version: 6.1.1(picomatch@2.3.1) + specifier: ^6.2.0 + version: 6.3.0(picomatch@4.0.2) is-reference: specifier: 1.2.1 version: 1.2.1 @@ -215,8 +215,8 @@ importers: specifier: ^0.30.3 version: 0.30.3 picomatch: - specifier: ^2.3.1 - version: 2.3.1 + specifier: ^4.0.2 + version: 4.0.2 devDependencies: '@rollup/plugin-json': specifier: ^5.0.0 @@ -295,12 +295,12 @@ importers: estree-walker: specifier: ^2.0.2 version: 2.0.2 - fast-glob: - specifier: ^3.2.12 - version: 3.2.12 magic-string: specifier: ^0.30.3 version: 0.30.3 + tinyglobby: + specifier: ^0.2.8 + version: 0.2.8 devDependencies: acorn: specifier: ^8.8.0 @@ -2286,7 +2286,7 @@ packages: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} concat-with-sourcemaps@1.1.0: resolution: {integrity: sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==} @@ -2723,10 +2723,18 @@ packages: fastq@1.13.0: resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} - fdir@6.1.1: - resolution: {integrity: sha512-QfKBVg453Dyn3mr0Q0O+Tkr1r79lOTAKSi9f/Ot4+qVEwxWhav2Z+SudrG9vQjM2aYRMQQZ2/Q1zdA8ACM1pDg==} + fdir@6.3.0: + resolution: {integrity: sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fdir@6.4.0: + resolution: {integrity: sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==} peerDependencies: - picomatch: 3.x + picomatch: ^3 || ^4 peerDependenciesMeta: picomatch: optional: true @@ -3669,6 +3677,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} @@ -4403,6 +4415,10 @@ packages: resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} engines: {node: '>=4'} + tinyglobby@0.2.8: + resolution: {integrity: sha512-AMLZywN0vbhiZi2neFEaj9VIIxC+PjDMsp0nAK6tpR86LJavZgHqGz0S/FOONwBygC+mu7R0/TyAQw0gx0Mu9Q==} + engines: {node: '>=12.0.0'} + to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -6959,9 +6975,13 @@ snapshots: dependencies: reusify: 1.0.4 - fdir@6.1.1(picomatch@2.3.1): + fdir@6.3.0(picomatch@4.0.2): optionalDependencies: - picomatch: 2.3.1 + picomatch: 4.0.2 + + fdir@6.4.0(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 figures@4.0.1: dependencies: @@ -7880,6 +7900,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + pify@4.0.1: {} pify@5.0.0: {} @@ -8620,6 +8642,11 @@ snapshots: time-zone@1.0.0: {} + tinyglobby@0.2.8: + dependencies: + fdir: 6.4.0(picomatch@4.0.2) + picomatch: 4.0.2 + to-fast-properties@2.0.0: {} to-regex-range@5.0.1: