Skip to content

Commit 6363569

Browse files
author
Mayank Raj
authored
Merge branch 'main' into fix/docs-typos-and-doc-links
2 parents 17d3bb9 + 3016f49 commit 6363569

File tree

32 files changed

+677
-122
lines changed

32 files changed

+677
-122
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: "\U0001F41B Bug report"
33
about: Create a report to help us improve
44
title: ""
5-
labels: bug
5+
type: "Bug"
66
assignees: ""
77
---
88

.github/ISSUE_TEMPLATE/custom.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
name: Custom
3-
about: Open an issue in the repo that is neither a bug or a feature, such a new idea
3+
about: Open an issue in the repo that is neither a bug or a feature.
44
title: ""
55
labels: ""
6+
type: ""
67
assignees: ""
78
---
89

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
name: "\U0001F680 Feature request"
33
about: Suggest a new ECMAScript feature to be implemented, or a new capability of the engine.
44
title: ""
5-
labels: enhancement
5+
type: "Feature"
6+
labels: ""
67
assignees: ""
78
---
89

.github/labeler.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
C-Actions:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- '.github/**'
5+
6+
C-AST:
7+
- changed-files:
8+
- any-glob-to-any-file: 'core/ast/**'
9+
10+
C-Benchmark:
11+
- changed-files:
12+
- any-glob-to-any-file:
13+
- 'benches/**'
14+
- 'core/engine/benches/**'
15+
16+
C-Builtins:
17+
- changed-files:
18+
- any-glob-to-any-file:
19+
- 'core/engine/src/builtins/**'
20+
- 'core/engine/src/object/builtins/**'
21+
- all-globs-to-all-files:
22+
- '!core/engine/src/object/builtins/intl/**'
23+
24+
C-CLI:
25+
- changed-files:
26+
- any-glob-to-any-file:
27+
- 'cli/**'
28+
29+
C-Dependencies:
30+
- changed-files:
31+
- any-glob-to-any-file:
32+
- '**/Cargo.lock'
33+
- '**/Cargo.toml'
34+
35+
C-Documentation:
36+
- changed-files:
37+
- any-glob-to-any-file:
38+
- '**/*.md'
39+
40+
C-FFI:
41+
- changed-files:
42+
- any-glob-to-any-file:
43+
- 'ffi/**'
44+
45+
C-GC:
46+
- changed-files:
47+
- any-glob-to-any-file:
48+
- 'core/gc/**'
49+
50+
C-Intl:
51+
- changed-files:
52+
- any-glob-to-any-file:
53+
- 'core/engine/src/builtins/intl/**'
54+
55+
C-Javascript:
56+
- changed-files:
57+
- any-glob-to-any-file:
58+
- '**/*.js'
59+
60+
C-Parser:
61+
- changed-files:
62+
- any-glob-to-any-file:
63+
- 'core/parser/**'
64+
65+
C-Runtime:
66+
- changed-files:
67+
- any-glob-to-any-file:
68+
- 'core/runtime/**'
69+
70+
C-Tests:
71+
- changed-files:
72+
- any-glob-to-any-file:
73+
- '**/tests/**'
74+
- '**/test*'
75+
76+
C-VM:
77+
- changed-files:
78+
- any-glob-to-any-file:
79+
- 'core/engine/src/bytecompiler/**'
80+
- 'core/engine/src/vm/**'
81+
82+
C-WebAssembly:
83+
- changed-files:
84+
- any-glob-to-any-file:
85+
- 'ffi/wasm/**'

.github/release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ changelog:
77
categories:
88
- title: Feature Enhancements
99
labels:
10-
- enhancement
10+
- A-Enhancement
1111
- title: Bug Fixes
1212
labels:
13-
- bug
13+
- A-Bug
14+
- title: Performance Improvements
15+
labels:
16+
- A-Performance
17+
- A-Memory
1418
- title: Internal Improvements
1519
labels:
16-
- Internal
17-
- memory
20+
- A-Internal
21+
- A-Technical Debt
1822
- title: Other Changes
1923
labels:
2024
- "*"

.github/workflows/labeler.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
- pull_request_target
4+
5+
jobs:
6+
labeler:
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/labeler@v6
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: PR Management
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, synchronize, closed]
6+
7+
jobs:
8+
manage_pr:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
issues: write
13+
steps:
14+
- name: Auto Add Label
15+
if: github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize'
16+
uses: actions/github-script@v8
17+
with:
18+
script: |
19+
github.rest.issues.addLabels({
20+
issue_number: context.issue.number,
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
labels: ['Waiting On Review']
24+
})
25+
26+
- name: Auto Remove Label
27+
if: github.event.action == 'closed'
28+
uses: actions/github-script@v8
29+
continue-on-error: true
30+
with:
31+
script: |
32+
try {
33+
await github.rest.issues.removeLabel({
34+
issue_number: context.issue.number,
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
name: 'Waiting On Review'
38+
});
39+
} catch (error) {
40+
console.log('Label "Waiting On Review" not found or could not be removed.');
41+
}
42+
43+
- name: Auto Assign Milestone
44+
if: github.event.action == 'opened'
45+
uses: actions/github-script@v8
46+
with:
47+
script: |
48+
// Fetch open milestones and assign the closest one
49+
const { data: milestones } = await github.rest.issues.listMilestones({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
state: 'open',
53+
sort: 'due_on',
54+
direction: 'asc'
55+
});
56+
57+
if (milestones.length > 0) {
58+
const latestMilestone = milestones[0];
59+
await github.rest.issues.update({
60+
issue_number: context.issue.number,
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
milestone: latestMilestone.number
64+
});
65+
}

benches/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2024"
55
publish = false
66

77
[dependencies]
8-
boa_engine.workspace = true
8+
boa_engine = { workspace = true, features = ["intl_bundled"] }
99
boa_runtime.workspace = true
1010

1111
[dev-dependencies]

core/ast/src/expression/call.rs

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,32 @@ impl VisitWith for SuperCall {
182182
}
183183
}
184184

185+
/// The phase of a dynamic import call.
186+
///
187+
/// Determines how the imported module is handled:
188+
/// - `Evaluation` (default): `import(specifier)` — loads, links, and evaluates the module.
189+
/// - `Defer`: `import.defer(specifier)` — deferred evaluation of the module.
190+
/// - `Source`: `import.source(specifier)` — source phase import.
191+
///
192+
/// More information:
193+
/// - [import-defer proposal][defer]
194+
/// - [source-phase-imports proposal][source]
195+
///
196+
/// [defer]: https://github.com/tc39/proposal-defer-import-eval
197+
/// [source]: https://github.com/tc39/proposal-source-phase-imports
198+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
199+
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
200+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
201+
pub enum ImportPhase {
202+
/// `import(specifier)` — standard dynamic import.
203+
#[default]
204+
Evaluation,
205+
/// `import.defer(specifier)` — deferred import evaluation.
206+
Defer,
207+
/// `import.source(specifier)` — source phase import.
208+
Source,
209+
}
210+
185211
/// The `import()` syntax, commonly called dynamic import, is a function-like expression that allows
186212
/// loading an ECMAScript module asynchronously and dynamically into a potentially non-module
187213
/// environment.
@@ -198,20 +224,22 @@ impl VisitWith for SuperCall {
198224
pub struct ImportCall {
199225
specifier: Box<Expression>,
200226
options: Option<Box<Expression>>,
227+
phase: ImportPhase,
201228
span: Span,
202229
}
203230

204231
impl ImportCall {
205232
/// Creates a new `ImportCall` AST node.
206233
#[inline]
207234
#[must_use]
208-
pub fn new<S>(specifier: S, options: Option<Expression>, span: Span) -> Self
235+
pub fn new<S>(specifier: S, options: Option<Expression>, phase: ImportPhase, span: Span) -> Self
209236
where
210237
S: Into<Expression>,
211238
{
212239
Self {
213240
specifier: Box::new(specifier.into()),
214241
options: options.map(Box::new),
242+
phase,
215243
span,
216244
}
217245
}
@@ -235,6 +263,13 @@ impl ImportCall {
235263
self.options.as_deref()
236264
}
237265

266+
/// Returns the phase of this import call.
267+
#[inline]
268+
#[must_use]
269+
pub const fn phase(&self) -> ImportPhase {
270+
self.phase
271+
}
272+
238273
/// Gets the module specifier of the import call.
239274
///
240275
/// This is an alias for [`Self::specifier`] for backwards compatibility.
@@ -256,14 +291,24 @@ impl Spanned for ImportCall {
256291
impl ToInternedString for ImportCall {
257292
#[inline]
258293
fn to_interned_string(&self, interner: &Interner) -> String {
294+
let phase_str = match self.phase {
295+
ImportPhase::Evaluation => "",
296+
ImportPhase::Defer => ".defer",
297+
ImportPhase::Source => ".source",
298+
};
259299
if let Some(options) = &self.options {
260300
format!(
261-
"import({}, {})",
301+
"import{}({}, {})",
302+
phase_str,
262303
self.specifier.to_interned_string(interner),
263304
options.to_interned_string(interner)
264305
)
265306
} else {
266-
format!("import({})", self.specifier.to_interned_string(interner))
307+
format!(
308+
"import{}({})",
309+
phase_str,
310+
self.specifier.to_interned_string(interner)
311+
)
267312
}
268313
}
269314
}

core/ast/src/expression/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::{
4545
visitor::{VisitWith, Visitor, VisitorMut},
4646
};
4747
pub use r#await::Await;
48-
pub use call::{Call, ImportCall, SuperCall};
48+
pub use call::{Call, ImportCall, ImportPhase, SuperCall};
4949
pub use identifier::{Identifier, RESERVED_IDENTIFIERS_STRICT};
5050
pub use import_meta::ImportMeta;
5151
pub use new::New;

0 commit comments

Comments
 (0)