Skip to content

Commit

Permalink
Merge branch 'rollup:master' into fix-typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Septh authored Oct 16, 2024
2 parents d901d87 + 0f45234 commit f45dc80
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 28 deletions.
8 changes: 8 additions & 0 deletions packages/commonjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
6 changes: 3 additions & 3 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-commonjs",
"version": "28.0.0",
"version": "28.0.1",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions packages/dynamic-import-vars/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
6 changes: 3 additions & 3 deletions packages/dynamic-import-vars/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-dynamic-import-vars",
"version": "2.1.3",
"version": "2.1.4",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/dynamic-import-vars/src/dynamic-import-to-glob.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';

import fastGlob from 'fast-glob';
import { escapePath } from 'tinyglobby';

export class VariableDynamicImportError extends Error {}

Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/dynamic-import-vars/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}`
);
Expand Down
8 changes: 8 additions & 0 deletions packages/typescript/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-typescript",
"version": "12.1.0",
"version": "12.1.1",
"publishConfig": {
"access": "public"
},
Expand Down
11 changes: 7 additions & 4 deletions packages/typescript/src/options/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
);
Expand Down
30 changes: 30 additions & 0 deletions packages/typescript/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 40 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f45dc80

Please sign in to comment.