Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ module.exports = grammar({
seq($.export_clause, $._from_clause),
$.export_clause,
),
optional($.import_attribute),
$._semicolon,
),
seq(
Expand Down Expand Up @@ -284,7 +285,7 @@ module.exports = grammar({
),
),

import_attribute: $ => seq('with', $.object),
import_attribute: $ => seq(choice('with', 'assert'), $.object),

//
// Statements
Expand Down
38 changes: 37 additions & 1 deletion test/corpus/statements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export { import1 as name1, import2 as name2, nameN } from 'foo';
export { import1 as "string name" } from 'foo';
export { "string import" as "string export" } from 'foo';

export { name1 } from './data.json' with { type: 'json' };
export * from './styles.css' assert { type: 'css' };
export * as ns from './module.js' with { type: 'js' };

----

(program
Expand Down Expand Up @@ -357,7 +361,39 @@ export { "string import" as "string export" } from 'foo';
alias: (string
(string_fragment))))
source: (string
(string_fragment))))
(string_fragment)))
(export_statement
(export_clause
(export_specifier
name: (identifier)))
source: (string
(string_fragment))
(import_attribute
(object
(pair
key: (property_identifier)
value: (string
(string_fragment))))))
(export_statement
source: (string
(string_fragment))
(import_attribute
(object
(pair
key: (property_identifier)
value: (string
(string_fragment))))))
(export_statement
(namespace_export
(identifier))
source: (string
(string_fragment))
(import_attribute
(object
(pair
key: (property_identifier)
value: (string
(string_fragment)))))))

============================================
Decorators before exports
Expand Down