Skip to content

Commit ba134c8

Browse files
committed
Merge branch 'master' of https://github.com/rollup/rollup into sync-9a7abe97
2 parents 2835322 + 9a7abe9 commit ba134c8

File tree

22 files changed

+1034
-774
lines changed

22 files changed

+1034
-774
lines changed

.github/actions/install-and-cache-node-deps/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
restore-keys: node-modules-${{ runner.os }}-${{ runner.arch }}
1515
- name: Install Node dependencies
1616
if: steps.cache-node-modules.outputs.cache-hit != 'true'
17-
run: npm ${{ github.ref == 'refs/heads/master' && 'ci' || 'install' }} --ignore-scripts
17+
run: npm ${{ github.ref == 'refs/heads/master' && 'ci' || 'install' }} --ignore-scripts && npm run postinstall --if-present
1818
shell: bash
1919
- name: Save Node dependencies cache
2020
if: steps.cache-node-modules.outputs.cache-hit != 'true' && github.ref == 'refs/heads/master'

.github/copilot-instructions.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# GitHub Copilot Agent Instructions for Rollup
2+
3+
This is the Rollup project, a module bundler for JavaScript.
4+
5+
## Technology Stack & Frameworks
6+
7+
- The application is written in TypeScript but contains a growing part of Rust code located in the `rust` folder that is called from TypeScript.
8+
- The website is a Vitepress project located in the `docs` folder.
9+
- The build system uses Rollup for bundling the TypeScript code.
10+
11+
## Repository Structure
12+
13+
- TypeScript code is in the `src` directory. The entry points are `src/node-entry.ts` and `src/browser-entry.ts`.
14+
- Tests are in the `test` directory, with subdirectories for different test types. Most test types have a `samples` subdirectory which in itself contains other folders, one for each test case. The test case is configured via a `_config.js` file in its folder. Additionally, `samples` can also include folders that contain no `_config.js` file but contain multiple sub-folders in tests to group related test cases. All tests run against the full Rollup artifact, there are no fine-grained unit tests to allow easy refactoring of internal APIs.
15+
- Rust code is in the `rust` directory. It is grouped into the `bindings_napi` and `bindings_wasm` crates to interface with TypeScript via napi-rs or wasmpack, and the `parse_ast` crate that contains a parser for JavaScript that generates a binary AST format.
16+
- Rust code is called via `native.js` and `native.wasm.js` in the `src` directory.
17+
- Development scripts are in the `scripts` directory.
18+
- Documentation is in the `docs` directory.
19+
20+
## Development Workflow
21+
22+
- In order to create a production build and run all tests, use `npm test`.
23+
- For quicker development cycles
24+
- first run either `npm run update:js` if TypeScript code was updated, or `npm run update:napi` if Rust code was updated.
25+
- then run `npm run test:only` to only run tests against the built artifact without rebuilding.
26+
- you can focus specific tests by adding `solo: true´ in their `\_config.js` file.
27+
28+
## Copilot-Specific Behaviors
29+
30+
- Only make changes that are fully justified by project documentation or explicit user requests. When in doubt, prefer conservative actions and reference relevant documentation.
31+
- Always consider and test for edge cases, especially when modifying core logic or build/test infrastructure.

.github/workflows/build-and-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
with:
264264
version: 0.14.1
265265
- name: Install cargo-zigbuild
266-
uses: taiki-e/install-action@5b5de1b4da26ad411330c0454bdd72929bfcbeb2 # v2.62.29
266+
uses: taiki-e/install-action@80466ef8efa80486cdfbddf929453a4f3565c791 # v2.62.34
267267
if: ${{ matrix.settings.cross == 'zig' }}
268268
env:
269269
GITHUB_TOKEN: ${{ github.token }}

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ Repository: git+https://gitlab.com/Rich-Harris/locate-character.git
395395
## magic-string
396396
License: MIT
397397
By: Rich Harris
398-
Repository: https://github.com/rich-harris/magic-string.git
398+
Repository: git+https://github.com/Rich-Harris/magic-string.git
399399

400400
> Copyright 2018 Rich Harris
401401
>

browser/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Repository: git+https://gitlab.com/Rich-Harris/locate-character.git
123123
## magic-string
124124
License: MIT
125125
By: Rich Harris
126-
Repository: https://github.com/rich-harris/magic-string
126+
Repository: https://github.com/rich-harris/magic-string.git
127127

128128
> Copyright 2018 Rich Harris
129129
>

browser/src/fs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { throwNoFileSystem } from './error';
33
import type * as FsType from './fs.ts';
44

55
// Ensure this satisfies the RollupFsModule API, will be removed by tree-shaking
6-
const _typeTest = null as unknown as typeof FsType satisfies RollupFsModule;
6+
void (null as unknown as typeof FsType satisfies RollupFsModule);
77

88
export const appendFile = throwNoFileSystem('fs.appendFile');
99
export const copyFile = throwNoFileSystem('fs.copyFile');

docs/.vitepress/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import alias from '@rollup/plugin-alias';
22
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
3-
import type { Plugin } from 'vite';
43
import { defineConfig } from 'vitepress';
54
import { moduleAliases } from '../../build-plugins/aliases';
65
import replaceBrowserModules from '../../build-plugins/replace-browser-modules';
6+
import type { ShikiTransformer } from '../../node_modules/vitepress/node_modules/@shikijs/types/dist/index';
77
import '../declarations.d';
88
import { examplesPlugin } from './create-examples';
99
import { renderMermaidGraphsPlugin } from './mermaid';
@@ -57,7 +57,7 @@ export default defineConfig({
5757
types: ['node']
5858
}
5959
}
60-
})
60+
}) as ShikiTransformer
6161
],
6262
config(md) {
6363
transposeTables(md);
@@ -179,7 +179,7 @@ export default defineConfig({
179179
}
180180
},
181181
examplesPlugin(),
182-
alias(moduleAliases) as unknown as Plugin
182+
alias(moduleAliases)
183183
]
184184
}
185185
});

docs/declarations.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
declare module 'examples.json' {
2-
import type { Example } from './types';
2+
import type { Example } from 'types';
33
const version: Record<string, Example>;
44
export default version;
55
}

docs/repl/components/BundleOptions.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
v-else-if="option.type === 'string'"
2424
:value="option.value"
2525
:placeholder="option.placeholder"
26-
@input="optionsStore.set(option.name, $event.target.value)"
26+
@input="optionsStore.set(option.name, ($event.target as HTMLInputElement).value)"
2727
/>
2828
<input
2929
v-else-if="option.type === 'number'"
@@ -32,7 +32,7 @@
3232
type="number"
3333
min="0"
3434
step="1"
35-
@input="optionsStore.set(option.name, Number($event.target.value))"
35+
@input="optionsStore.set(option.name, Number(($event.target as HTMLInputElement).value))"
3636
/>
3737
<div
3838
v-for="imported in option.keys"
@@ -41,9 +41,12 @@
4141
class="input-with-label"
4242
>
4343
<input
44-
:value="option.value[imported]"
44+
:value="option.value?.[imported]"
4545
@input="
46-
optionsStore.set(option.name, { ...option.value, [imported]: $event.target.value })
46+
optionsStore.set(option.name, {
47+
...option.value,
48+
[imported]: ($event.target as HTMLInputElement).value
49+
})
4750
"
4851
/>
4952
<code>'{{ imported }}'</code>
@@ -53,8 +56,8 @@
5356
<div v-if="optionsStore.additionalAvailableOptions.length > 0" class="add-option">
5457
<select
5558
@input="
56-
optionsStore.addOption($event.target.value);
57-
$event.target.value = '_';
59+
optionsStore.addOption(($event.target as HTMLSelectElement).value);
60+
($event.target as HTMLSelectElement).value = '_';
5861
"
5962
>
6063
<option disabled selected value="_">添加设置</option>

docs/repl/stores/options.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface OptionTypeSelect<T> extends BaseOptionType<T> {
2020
}
2121

2222
interface OptionTypeString extends BaseOptionType<string> {
23-
placeholder: string | null;
23+
placeholder: string | undefined;
2424
type: 'string';
2525
}
2626

@@ -30,7 +30,7 @@ interface OptionTypeStringMapping extends BaseOptionType<Record<string, string>>
3030
}
3131

3232
interface OptionTypeNumber extends BaseOptionType<number> {
33-
placeholder: string | null;
33+
placeholder: string | undefined;
3434
type: 'number';
3535
}
3636

@@ -617,7 +617,7 @@ function getString({
617617
available: typeof available === 'function' ? computed(available) : available || alwaysTrue,
618618
defaultValue: defaultValue ?? '',
619619
name,
620-
placeholder: placeholder || null,
620+
placeholder,
621621
required: required ? computed(required) : alwaysFalse,
622622
type: 'string',
623623
value: ref(undefined)
@@ -664,7 +664,7 @@ function getNumber({
664664
available: typeof available === 'function' ? computed(available) : available || alwaysTrue,
665665
defaultValue: defaultValue ?? 0,
666666
name,
667-
placeholder: placeholder || null,
667+
placeholder,
668668
required: required ? computed(required) : alwaysFalse,
669669
type: 'number',
670670
value: ref(undefined)

0 commit comments

Comments
 (0)