Skip to content

Commit 758609c

Browse files
authored
feat: pass originalFileName (#183)
1 parent f504909 commit 758609c

File tree

17 files changed

+3940
-2982
lines changed

17 files changed

+3940
-2982
lines changed

.changeset/beige-berries-create.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rollup-extras/plugin-copy": minor
3+
---
4+
5+
Pass result of path.resolve() in originalFileName property into emitFile. It should not affect older rollup versions but potentially fixes #182.

.changeset/slimy-cases-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rollup-extras/utils": patch
3+
---
4+
5+
fixed typings

.github/workflows/main.yml

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,9 @@ on:
2222
- alpha
2323
- beta
2424

25-
concurrency:
26-
group: ${{ github.head_ref || github.ref_name }}
27-
cancel-in-progress: true
28-
2925
jobs:
30-
build:
31-
32-
runs-on: ubuntu-latest
33-
34-
strategy:
35-
matrix:
36-
node-version: [16.x, 18.x, 20.x]
37-
38-
steps:
39-
- uses: actions/checkout@v4
40-
- uses: pnpm/action-setup@v2
41-
with:
42-
version: 7
43-
- name: Use Node.js ${{ matrix.node-version }}
44-
uses: actions/setup-node@v4
45-
with:
46-
node-version: ${{ matrix.node-version }}
47-
cache: 'pnpm'
48-
- run: pnpm install --frozen-lockfile --prefer-offline --reporter=append-only
49-
- run: pnpm run lint
50-
- run: pnpm run build
51-
- run: pnpm test
52-
53-
publish:
54-
55-
if: github.ref_name == 'main'
56-
57-
needs: build
58-
59-
runs-on: ubuntu-latest
60-
61-
steps:
62-
- uses: actions/checkout@v4
63-
- uses: pnpm/action-setup@v2
64-
with:
65-
version: 7
66-
- name: Use Node.js
67-
uses: actions/setup-node@v4
68-
with:
69-
node-version: '18.x'
70-
registry-url: 'https://registry.npmjs.org'
71-
scope: '@rollup-extras'
72-
cache: 'pnpm'
73-
- run: pnpm install --frozen-lockfile --prefer-offline --reporter=append-only
74-
- run: pnpm run build
75-
- name: create and publish versions
76-
uses: changesets/action@v1
77-
with:
78-
commit: "chore: update versions"
79-
title: "chore: release"
80-
publish: "pnpm run ci:publish"
81-
env:
82-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26+
pipeline:
27+
with:
28+
scope: '@rollup-extras'
29+
uses: kshutkin/pipeline/.github/workflows/main.yml@main
30+
secrets: inherit

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@typescript-eslint/parser": "^7.0.0",
1919
"eslint": "^8.37.0",
2020
"jest": "^29.5.0",
21-
"pkgbld-internal": "~1.4.0",
21+
"pkgbld-internal": "~1.8.2",
2222
"ts-jest": "^29.1.0"
2323
}
2424
}

plugin-angularjs-template-cache/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"exports": {
1111
".": {
1212
"types": "./dist/index.d.ts",
13-
"import": "./dist/index.mjs",
1413
"require": "./dist/index.cjs",
14+
"import": "./dist/index.mjs",
1515
"default": "./dist/index.mjs"
1616
},
1717
"./package.json": "./package.json"
@@ -60,5 +60,16 @@
6060
"optional": true
6161
}
6262
},
63-
"types": "./dist/index.d.ts"
63+
"types": "./dist/index.d.ts",
64+
"typesVersions": {
65+
"*": {
66+
".": [
67+
"dist/index.d.ts"
68+
],
69+
"*": [
70+
"dist/index.d.ts",
71+
"dist/*"
72+
]
73+
}
74+
}
6475
}

plugin-binify/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"exports": {
1111
".": {
1212
"types": "./dist/index.d.ts",
13-
"import": "./dist/index.mjs",
1413
"require": "./dist/index.cjs",
14+
"import": "./dist/index.mjs",
1515
"default": "./dist/index.mjs"
1616
},
1717
"./package.json": "./package.json"
@@ -54,5 +54,16 @@
5454
"optional": true
5555
}
5656
},
57-
"types": "./dist/index.d.ts"
57+
"types": "./dist/index.d.ts",
58+
"typesVersions": {
59+
"*": {
60+
".": [
61+
"dist/index.d.ts"
62+
],
63+
"*": [
64+
"dist/index.d.ts",
65+
"dist/*"
66+
]
67+
}
68+
}
5869
}

plugin-clean/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"exports": {
1111
".": {
1212
"types": "./dist/index.d.ts",
13-
"import": "./dist/index.mjs",
1413
"require": "./dist/index.cjs",
14+
"import": "./dist/index.mjs",
1515
"default": "./dist/index.mjs"
1616
},
1717
"./package.json": "./package.json"
@@ -54,5 +54,16 @@
5454
"optional": true
5555
}
5656
},
57-
"types": "./dist/index.d.ts"
57+
"types": "./dist/index.d.ts",
58+
"typesVersions": {
59+
"*": {
60+
".": [
61+
"dist/index.d.ts"
62+
],
63+
"*": [
64+
"dist/index.d.ts",
65+
"dist/*"
66+
]
67+
}
68+
}
5869
}

plugin-copy/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"exports": {
1111
".": {
1212
"types": "./dist/index.d.ts",
13-
"import": "./dist/index.mjs",
1413
"require": "./dist/index.cjs",
14+
"import": "./dist/index.mjs",
1515
"default": "./dist/index.mjs"
1616
},
1717
"./package.json": "./package.json"
@@ -60,5 +60,16 @@
6060
"optional": true
6161
}
6262
},
63-
"types": "./dist/index.d.ts"
63+
"types": "./dist/index.d.ts",
64+
"typesVersions": {
65+
"*": {
66+
".": [
67+
"dist/index.d.ts"
68+
],
69+
"*": [
70+
"dist/index.d.ts",
71+
"dist/*"
72+
]
73+
}
74+
}
6475
}

plugin-copy/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs_ from 'fs';
33
import path from 'path';
44
import { glob } from 'glob';
55
import globParent from 'glob-parent';
6-
import { PluginContext, Plugin } from 'rollup';
6+
import { PluginContext, Plugin, EmittedFile } from 'rollup';
77
import { CopyPluginOptions, NonTargetOptions, SingleTargetDesc } from './types';
88
import { createLogger, LogLevel } from '@niceties/logger';
99
import { getOptions } from '@rollup-extras/utils/options';
@@ -128,8 +128,9 @@ export default function(options: CopyPluginOptions) {
128128
(this as unknown as PluginContext).emitFile({
129129
type: 'asset',
130130
[exactFileNames ? 'fileName' : 'name']: destFileName,
131-
source
132-
});
131+
source: source as Uint8Array | undefined,
132+
originalFileName: path.resolve(fileName)
133+
} as EmittedFile);
133134
} else {
134135
await fs.mkdir(path.dirname(destFileName), { recursive: true });
135136
await fs.copyFile(fileName, destFileName, fs_.constants.COPYFILE_FICLONE);

plugin-exec/package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"exports": {
1111
".": {
1212
"types": "./dist/index.d.ts",
13-
"import": "./dist/index.mjs",
1413
"require": "./dist/index.cjs",
14+
"import": "./dist/index.mjs",
1515
"default": "./dist/index.mjs"
1616
},
1717
"./package.json": "./package.json"
@@ -53,5 +53,16 @@
5353
"optional": true
5454
}
5555
},
56-
"types": "./dist/index.d.ts"
56+
"types": "./dist/index.d.ts",
57+
"typesVersions": {
58+
"*": {
59+
".": [
60+
"dist/index.d.ts"
61+
],
62+
"*": [
63+
"dist/index.d.ts",
64+
"dist/*"
65+
]
66+
}
67+
}
5768
}

0 commit comments

Comments
 (0)