diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 764f129f..c3f3af69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [22.x, 21.x, 20.x, 18.x, "18.18.0"] + node: [23.x, 22.x, 21.x, 20.x, 18.x, "18.18.0"] include: - os: windows-latest node: "lts/*" diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f618dfd6..ff50f2d2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,5 @@ { - "packages/espree": "10.2.0", - "packages/eslint-scope": "8.1.0", - "packages/eslint-visitor-keys": "4.1.0" + "packages/espree": "10.3.0", + "packages/eslint-scope": "8.2.0", + "packages/eslint-visitor-keys": "4.2.0" } diff --git a/README.md b/README.md index 72aa6463..274b729f 100644 --- a/README.md +++ b/README.md @@ -14,20 +14,19 @@ This repository is the home of the following packages: We work hard to ensure that the packages inside this repository are safe for everyone and that security issues are addressed quickly and responsibly. Read the full [security policy](https://github.com/eslint/.github/blob/master/SECURITY.md). + + ## Sponsors -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) to get your logo on our README and website. +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) +to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Anagram Solver Icons8 Discord GitBook Nx HeroCoders Nextbase Starter Kit

- - - -

Technology Sponsors

+

WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Technology Sponsors

+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

Netlify Algolia 1Password

- + diff --git a/package.json b/package.json index 650c49a6..5e715a54 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ ] }, "devDependencies": { - "common-tags": "^1.8.2", "eslint": "^9.11.1", "eslint-config-eslint": "^11.0.0", "eslint-plugin-chai-friendly": "^1.0.0", diff --git a/packages/eslint-scope/CHANGELOG.md b/packages/eslint-scope/CHANGELOG.md index 99e9920a..1882cc54 100644 --- a/packages/eslint-scope/CHANGELOG.md +++ b/packages/eslint-scope/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [8.2.0](https://github.com/eslint/js/compare/eslint-scope-v8.1.0...eslint-scope-v8.2.0) (2024-10-29) + + +### Features + +* add support for Import Attributes and RegExp Modifiers ([#639](https://github.com/eslint/js/issues/639)) ([2fd4222](https://github.com/eslint/js/commit/2fd422278bfad826d601795670004f9d6da72ef7)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * eslint-visitor-keys bumped from ^4.1.0 to ^4.2.0 + * espree bumped from ^10.2.0 to ^10.3.0 + ## [8.1.0](https://github.com/eslint/js/compare/eslint-scope-v8.0.2...eslint-scope-v8.1.0) (2024-09-27) diff --git a/packages/eslint-scope/README.md b/packages/eslint-scope/README.md index 2cdce2b9..e60b4db3 100644 --- a/packages/eslint-scope/README.md +++ b/packages/eslint-scope/README.md @@ -90,20 +90,19 @@ We work hard to ensure that ESLint Scope is safe for everyone and that security ESLint Scope is licensed under a permissive BSD 2-clause license. + + ## Sponsors -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) to get your logo on our README and website. +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) +to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Anagram Solver Icons8 Discord GitBook Nx HeroCoders Nextbase Starter Kit

- - - -

Technology Sponsors

+

WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Technology Sponsors

+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

Netlify Algolia 1Password

- + diff --git a/packages/eslint-scope/package.json b/packages/eslint-scope/package.json index ffc065c6..759d8ec3 100644 --- a/packages/eslint-scope/package.json +++ b/packages/eslint-scope/package.json @@ -11,7 +11,7 @@ }, "./package.json": "./package.json" }, - "version": "8.1.0", + "version": "8.2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -48,8 +48,8 @@ "c8": "^7.7.3", "chai": "^4.3.4", "eslint-release": "^3.2.0", - "eslint-visitor-keys": "^4.1.0", - "espree": "^10.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", "mocha": "^9.0.1", "npm-license": "^0.3.3", "rollup": "^2.52.7", diff --git a/packages/eslint-scope/rollup.config.js b/packages/eslint-scope/rollup.config.js index 135e147a..564ff2f7 100644 --- a/packages/eslint-scope/rollup.config.js +++ b/packages/eslint-scope/rollup.config.js @@ -1,6 +1,6 @@ export default { input: "./lib/index.js", - external: ["assert", "estraverse", "esrecurse"], + external: ["estraverse", "esrecurse"], treeshake: false, output: { format: "cjs", diff --git a/packages/eslint-scope/tests/import-attributes.js b/packages/eslint-scope/tests/import-attributes.js new file mode 100644 index 00000000..b76cfb77 --- /dev/null +++ b/packages/eslint-scope/tests/import-attributes.js @@ -0,0 +1,185 @@ +/** + * @fileoverview Tests for ES2025 Import Attributes. + * @author Yosuke Ota + */ + +import assert from "node:assert"; +import * as espree from "espree"; +import { KEYS } from "eslint-visitor-keys"; +import { analyze } from "../lib/index.js"; + +describe("Import Attributes", () => { + + describe("const type = \"json\"; import pkg from \"./package.json\" with { type: \"json\" };", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; import pkg from \"./package.json\" with { type: \"json\" };", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have two variables", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 2); + assert.strictEqual(moduleScope.variables[0].name, "type"); + assert.strictEqual(moduleScope.variables[1].name, "pkg"); + }); + + it("the type variable should have one reference, a variable declaration", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 1); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + }); + }); + + describe("const type = \"json\"; export * from \"./package.json\" with { type: \"json\" };", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; export * from \"./package.json\" with { type: \"json\" };", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have one variable, a type variable", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 1); + assert.strictEqual(moduleScope.variables[0].name, "type"); + }); + + it("the type variable should have one reference, a variable declaration", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 1); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + }); + }); + + + describe("const type = \"json\"; export { default } from \"./package.json\" with { type: \"json\" };", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; export { default } from \"./package.json\" with { type: \"json\" };", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have one variable, a type variable", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 1); + assert.strictEqual(moduleScope.variables[0].name, "type"); + }); + + it("the type variable should have one reference, a variable declaration", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 1); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + }); + }); + + + describe("const type = \"json\"; import(\"./package.json\", { with: { type } });", () => { + let ast; + let scopeManager; + let globalScope; + + beforeEach(() => { + ast = espree.parse("const type = \"json\"; import(\"./package.json\", { with: { type } });", { ecmaVersion: 16, sourceType: "module" }); + scopeManager = analyze(ast, { ecmaVersion: 16, sourceType: "module", childVisitorKeys: KEYS }); + ({ globalScope } = scopeManager); + }); + + it("the global scope should not have any variables", () => { + assert.strictEqual(globalScope.variables.length, 0); + }); + + it("the global scope should have one child scope, a module scope", () => { + assert.strictEqual(globalScope.childScopes.length, 1); + assert.strictEqual(globalScope.childScopes[0].type, "module"); + }); + + it("the module scope should not have any child scopes", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.childScopes.length, 0); + }); + + it("the module scope should have one variable, a type variable", () => { + const moduleScope = globalScope.childScopes[0]; + + assert.strictEqual(moduleScope.variables.length, 1); + assert.strictEqual(moduleScope.variables[0].name, "type"); + }); + + + it("the type variable should have two references, a variable declaration and import options", () => { + const moduleScope = globalScope.childScopes[0]; + const typeVariable = moduleScope.variables[0]; + + assert.strictEqual(typeVariable.references.length, 2); + assert.strictEqual(typeVariable.references[0].identifier, ast.body[0].declarations[0].id); + assert.strictEqual(typeVariable.references[1].identifier, ast.body[1].expression.options.properties[0].value.properties[0].value); + }); + }); +}); diff --git a/packages/eslint-visitor-keys/CHANGELOG.md b/packages/eslint-visitor-keys/CHANGELOG.md index c5d622b3..ac62fe31 100644 --- a/packages/eslint-visitor-keys/CHANGELOG.md +++ b/packages/eslint-visitor-keys/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [4.2.0](https://github.com/eslint/js/compare/eslint-visitor-keys-v4.1.0...eslint-visitor-keys-v4.2.0) (2024-10-29) + + +### Features + +* add support for Import Attributes and RegExp Modifiers ([#639](https://github.com/eslint/js/issues/639)) ([2fd4222](https://github.com/eslint/js/commit/2fd422278bfad826d601795670004f9d6da72ef7)) + ## [4.1.0](https://github.com/eslint/js/compare/eslint-visitor-keys-v4.0.0...eslint-visitor-keys-v4.1.0) (2024-09-27) diff --git a/packages/eslint-visitor-keys/README.md b/packages/eslint-visitor-keys/README.md index 3bea023e..3cbbdd39 100644 --- a/packages/eslint-visitor-keys/README.md +++ b/packages/eslint-visitor-keys/README.md @@ -102,20 +102,19 @@ Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer- [Node.js]: https://nodejs.org/ [ESTree]: https://github.com/estree/estree + + ## Sponsors -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) to get your logo on our README and website. +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) +to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Anagram Solver Icons8 Discord GitBook Nx HeroCoders Nextbase Starter Kit

- - - -

Technology Sponsors

+

WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Technology Sponsors

+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

Netlify Algolia 1Password

- + diff --git a/packages/eslint-visitor-keys/lib/visitor-keys.js b/packages/eslint-visitor-keys/lib/visitor-keys.js index f54a3474..41feb4b2 100644 --- a/packages/eslint-visitor-keys/lib/visitor-keys.js +++ b/packages/eslint-visitor-keys/lib/visitor-keys.js @@ -87,7 +87,8 @@ const KEYS = { ], ExportAllDeclaration: [ "exported", - "source" + "source", + "attributes" ], ExportDefaultDeclaration: [ "declaration" @@ -95,7 +96,8 @@ const KEYS = { ExportNamedDeclaration: [ "declaration", "specifiers", - "source" + "source", + "attributes" ], ExportSpecifier: [ "exported", @@ -136,15 +138,21 @@ const KEYS = { "consequent", "alternate" ], + ImportAttribute: [ + "key", + "value" + ], ImportDeclaration: [ "specifiers", - "source" + "source", + "attributes" ], ImportDefaultSpecifier: [ "local" ], ImportExpression: [ - "source" + "source", + "options" ], ImportNamespaceSpecifier: [ "local" diff --git a/packages/eslint-visitor-keys/package.json b/packages/eslint-visitor-keys/package.json index 708c46d3..4dc2123d 100644 --- a/packages/eslint-visitor-keys/package.json +++ b/packages/eslint-visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "eslint-visitor-keys", - "version": "4.1.0", + "version": "4.2.0", "description": "Constants and utilities about visitor keys to traverse AST.", "type": "module", "main": "dist/eslint-visitor-keys.cjs", diff --git a/packages/espree/CHANGELOG.md b/packages/espree/CHANGELOG.md index e789cd28..dc5b5738 100644 --- a/packages/espree/CHANGELOG.md +++ b/packages/espree/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [10.3.0](https://github.com/eslint/js/compare/espree-v10.2.0...espree-v10.3.0) (2024-10-29) + + +### Features + +* add support for Import Attributes and RegExp Modifiers ([#639](https://github.com/eslint/js/issues/639)) ([2fd4222](https://github.com/eslint/js/commit/2fd422278bfad826d601795670004f9d6da72ef7)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * eslint-visitor-keys bumped from ^4.1.0 to ^4.2.0 + ## [10.2.0](https://github.com/eslint/js/compare/espree-v10.1.0...espree-v10.2.0) (2024-09-27) diff --git a/packages/espree/README.md b/packages/espree/README.md index 415fa6be..b971ea5a 100644 --- a/packages/espree/README.md +++ b/packages/espree/README.md @@ -243,20 +243,19 @@ See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finish In general, we do not support experimental JavaScript features. We may make exceptions from time to time depending on the maturity of the features. + + ## Sponsors -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) to get your logo on our README and website. +The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) +to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

Automattic Airbnb

Gold Sponsors

trunk.io

Silver Sponsors

JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Anagram Solver Icons8 Discord GitBook Nx HeroCoders Nextbase Starter Kit

- - - -

Technology Sponsors

+

WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

+

Technology Sponsors

+Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

Netlify Algolia 1Password

- + diff --git a/packages/espree/docs/README.md b/packages/espree/docs/README.md index a783216f..cacb72e3 100644 --- a/packages/espree/docs/README.md +++ b/packages/espree/docs/README.md @@ -236,6 +236,8 @@ Espree supports all ECMAScript 2024 features and partially supports ECMAScript 2 Because ECMAScript 2025 is still under development, we are implementing features as they are finalized. Currently, Espree supports: * [RegExp Duplicate named capturing groups](https://github.com/tc39/proposal-duplicate-named-capturing-groups) +* [RegExp Pattern modifiers](https://github.com/tc39/proposal-regexp-modifiers) +* [Import Attributes](https://github.com/tc39/proposal-import-attributes) See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to know what features are finalized. diff --git a/packages/espree/package.json b/packages/espree/package.json index 17d075d0..ca08d881 100644 --- a/packages/espree/package.json +++ b/packages/espree/package.json @@ -16,7 +16,7 @@ ], "./package.json": "./package.json" }, - "version": "10.2.0", + "version": "10.3.0", "files": [ "lib", "dist/espree.cjs", @@ -32,9 +32,9 @@ "funding": "https://opencollective.com/eslint", "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.12.0", + "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.1.0" + "eslint-visitor-keys": "^4.2.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^28.0.0", diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js new file mode 100644 index 00000000..d325af7b --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Duplicate attribute key 'type'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js new file mode 100644 index 00000000..b0e54b16 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dupe-key.src.js @@ -0,0 +1 @@ +import "./foo.json" with { type: "json", type: "html" }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js new file mode 100644 index 00000000..094f16ff --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.result.js @@ -0,0 +1,6 @@ +export default { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js new file mode 100644 index 00000000..497bf31e --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-dynamic-with-multiple-trailing-comma.src.js @@ -0,0 +1 @@ +import("foo.json", , ); diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js new file mode 100644 index 00000000..7e321e96 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js new file mode 100644 index 00000000..829b2008 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-multiple-trailing-comma.src.js @@ -0,0 +1 @@ +import "./foo.json" with { type: "json", , }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js new file mode 100644 index 00000000..857f4294 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 27, + "lineNumber": 1, + "column": 28, + "message": "Unexpected token 42" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js new file mode 100644 index 00000000..e027bc72 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-key.src.js @@ -0,0 +1 @@ +import "./foo.json" with { 42: "s" }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js new file mode 100644 index 00000000..93a8baf7 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.module-result.js @@ -0,0 +1,6 @@ +export default { + "index": 33, + "lineNumber": 1, + "column": 34, + "message": "Unexpected token 42" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js new file mode 100644 index 00000000..24a34555 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/invalid-import-attributes-with-number-value.src.js @@ -0,0 +1 @@ +import "./foo.json" with { type: 42 }; diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js new file mode 100644 index 00000000..afabbb96 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.module-result.js @@ -0,0 +1,4157 @@ +export default { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 46 + } + }, + "range": [ + 0, + 670 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 0, + 52 + ], + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "name": "json" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 17, + 29 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 37, + 49 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 37, + 41 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 43, + 49 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "range": [ + 53, + 95 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "range": [ + 60, + 72 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 80, + 92 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "range": [ + 80, + 84 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 86, + 92 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 51 + } + }, + "range": [ + 96, + 147 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ], + "name": "v" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ], + "name": "v" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 112, + 124 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 48 + } + }, + "range": [ + 132, + 144 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "range": [ + 132, + 136 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 42 + }, + "end": { + "line": 3, + "column": 48 + } + }, + "range": [ + 138, + 144 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ExportAllDeclaration", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 57 + } + }, + "range": [ + 148, + 205 + ], + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "range": [ + 160, + 164 + ], + "name": "json" + }, + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "range": [ + 170, + 182 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, + "column": 54 + } + }, + "range": [ + 190, + 202 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, + "column": 46 + } + }, + "range": [ + 190, + 194 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 48 + }, + "end": { + "line": 4, + "column": 54 + } + }, + "range": [ + 196, + 202 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 57 + } + }, + "range": [ + 206, + 263 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "range": [ + 212, + 262 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 212, + 213 + ], + "name": "a" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "range": [ + 216, + 262 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "range": [ + 223, + 233 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 55 + } + }, + "range": [ + 235, + 261 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "range": [ + 237, + 259 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "range": [ + 237, + 241 + ], + "name": "with" + }, + "value": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "range": [ + 243, + 259 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 51 + } + }, + "range": [ + 245, + 257 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 43 + } + }, + "range": [ + 245, + 249 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 45 + }, + "end": { + "line": 5, + "column": 51 + } + }, + "range": [ + 251, + 257 + ], + "value": "json", + "raw": "\"json\"" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 31 + } + }, + "range": [ + 264, + 295 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 30 + } + }, + "range": [ + 270, + 294 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 270, + 271 + ], + "name": "b" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 30 + } + }, + "range": [ + 274, + 294 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 27 + } + }, + "range": [ + 281, + 291 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": null + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 59 + } + }, + "range": [ + 320, + 379 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 58 + } + }, + "range": [ + 326, + 378 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 326, + 327 + ], + "name": "c" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 58 + } + }, + "range": [ + 330, + 378 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 27 + } + }, + "range": [ + 337, + 347 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 55 + } + }, + "range": [ + 349, + 375 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 53 + } + }, + "range": [ + 351, + 373 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 35 + } + }, + "range": [ + 351, + 355 + ], + "name": "with" + }, + "value": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 7, + "column": 37 + }, + "end": { + "line": 7, + "column": 53 + } + }, + "range": [ + 357, + 373 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "range": [ + 359, + 371 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 43 + } + }, + "range": [ + 359, + 363 + ], + "name": "type" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "range": [ + 365, + 371 + ], + "value": "json", + "raw": "\"json\"" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 35 + } + }, + "range": [ + 380, + 415 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "range": [ + 386, + 414 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 386, + 387 + ], + "name": "d" + }, + "init": { + "type": "ImportExpression", + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "range": [ + 390, + 414 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 27 + } + }, + "range": [ + 397, + 407 + ], + "value": "foo.json", + "raw": "\"foo.json\"" + }, + "options": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 32 + } + }, + "range": [ + 409, + 412 + ], + "name": "foo" + } + } + } + ], + "kind": "const" + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 416, + 456 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + }, + "range": [ + 423, + 435 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "range": [ + 443, + 453 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "range": [ + 443, + 446 + ], + "name": "foo" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "range": [ + 448, + 453 + ], + "value": "bar", + "raw": "\"bar\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "range": [ + 485, + 529 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "range": [ + 492, + 504 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "range": [ + 512, + 526 + ], + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 33 + } + }, + "range": [ + 512, + 518 + ], + "value": "type", + "raw": "\"type\"" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "range": [ + 520, + 526 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 44 + } + }, + "range": [ + 550, + 594 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "range": [ + 557, + 569 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 577, + 583 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "range": [ + 577, + 578 + ], + "name": "a" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 580, + 583 + ], + "value": "a", + "raw": "\"a\"" + } + }, + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 41 + } + }, + "range": [ + 585, + 591 + ], + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 36 + } + }, + "range": [ + 585, + 586 + ], + "name": "b" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 11, + "column": 38 + }, + "end": { + "line": 11, + "column": 41 + } + }, + "range": [ + 588, + 591 + ], + "value": "b", + "raw": "\"b\"" + } + } + ] + }, + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 46 + } + }, + "range": [ + 624, + 670 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 19 + } + }, + "range": [ + 631, + 643 + ], + "value": "./foo.json", + "raw": "\"./foo.json\"" + }, + "attributes": [ + { + "type": "ImportAttribute", + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 41 + } + }, + "range": [ + 651, + 665 + ], + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 33 + } + }, + "range": [ + 651, + 657 + ], + "value": "type", + "raw": "\"type\"" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 41 + } + }, + "range": [ + 659, + 665 + ], + "value": "json", + "raw": "\"json\"" + } + } + ] + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "json", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 12, + 16 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 17, + 29 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 30, + 34 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 37, + 41 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 43, + 49 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 53, + 59 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "range": [ + 60, + 72 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "range": [ + 73, + 77 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "range": [ + 78, + 79 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "range": [ + 80, + 84 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "range": [ + 84, + 85 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 86, + 92 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "range": [ + 93, + 94 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "range": [ + 94, + 95 + ] + }, + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "range": [ + 96, + 102 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 103, + 104 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 104, + 105 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 105, + 106 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 107, + 111 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 112, + 124 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "range": [ + 125, + 129 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "range": [ + 130, + 131 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "range": [ + 132, + 136 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "range": [ + 136, + 137 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 3, + "column": 42 + }, + "end": { + "line": 3, + "column": 48 + } + }, + "range": [ + 138, + 144 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 49 + }, + "end": { + "line": 3, + "column": 50 + } + }, + "range": [ + 145, + 146 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 50 + }, + "end": { + "line": 3, + "column": 51 + } + }, + "range": [ + 146, + 147 + ] + }, + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + }, + "range": [ + 148, + 154 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "range": [ + 155, + 156 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 157, + 159 + ] + }, + { + "type": "Identifier", + "value": "json", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "range": [ + 160, + 164 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "range": [ + 165, + 169 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "range": [ + 170, + 182 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 39 + } + }, + "range": [ + 183, + 187 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 4, + "column": 41 + } + }, + "range": [ + 188, + 189 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, + "column": 46 + } + }, + "range": [ + 190, + 194 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 4, + "column": 46 + }, + "end": { + "line": 4, + "column": 47 + } + }, + "range": [ + 194, + 195 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 4, + "column": 48 + }, + "end": { + "line": 4, + "column": 54 + } + }, + "range": [ + 196, + 202 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 55 + }, + "end": { + "line": 4, + "column": 56 + } + }, + "range": [ + 203, + 204 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 56 + }, + "end": { + "line": 4, + "column": 57 + } + }, + "range": [ + 204, + 205 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 206, + 211 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 212, + 213 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 214, + 215 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "range": [ + 216, + 222 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + }, + "range": [ + 222, + 223 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "range": [ + 223, + 233 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + }, + "range": [ + 233, + 234 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + }, + "range": [ + 235, + 236 + ] + }, + { + "type": "Identifier", + "value": "with", + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "range": [ + 237, + 241 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "range": [ + 241, + 242 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "range": [ + 243, + 244 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 43 + } + }, + "range": [ + 245, + 249 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 44 + } + }, + "range": [ + 249, + 250 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 5, + "column": 45 + }, + "end": { + "line": 5, + "column": 51 + } + }, + "range": [ + 251, + 257 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 52 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "range": [ + 258, + 259 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 54 + }, + "end": { + "line": 5, + "column": 55 + } + }, + "range": [ + 260, + 261 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 5, + "column": 55 + }, + "end": { + "line": 5, + "column": 56 + } + }, + "range": [ + 261, + 262 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 56 + }, + "end": { + "line": 5, + "column": 57 + } + }, + "range": [ + 262, + 263 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 5 + } + }, + "range": [ + 264, + 269 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 270, + 271 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "range": [ + 272, + 273 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + }, + "range": [ + 274, + 280 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "range": [ + 280, + 281 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 27 + } + }, + "range": [ + 281, + 291 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 28 + } + }, + "range": [ + 291, + 292 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 6, + "column": 29 + }, + "end": { + "line": 6, + "column": 30 + } + }, + "range": [ + 293, + 294 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 30 + }, + "end": { + "line": 6, + "column": 31 + } + }, + "range": [ + 294, + 295 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + } + }, + "range": [ + 320, + 325 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 326, + 327 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + }, + "range": [ + 328, + 329 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 16 + } + }, + "range": [ + 330, + 336 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + }, + "range": [ + 336, + 337 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 27 + } + }, + "range": [ + 337, + 347 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 28 + } + }, + "range": [ + 347, + 348 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "range": [ + 349, + 350 + ] + }, + { + "type": "Identifier", + "value": "with", + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 35 + } + }, + "range": [ + 351, + 355 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 7, + "column": 35 + }, + "end": { + "line": 7, + "column": 36 + } + }, + "range": [ + 355, + 356 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 7, + "column": 37 + }, + "end": { + "line": 7, + "column": 38 + } + }, + "range": [ + 357, + 358 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 7, + "column": 39 + }, + "end": { + "line": 7, + "column": 43 + } + }, + "range": [ + 359, + 363 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 7, + "column": 43 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "range": [ + 363, + 364 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "range": [ + 365, + 371 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 52 + }, + "end": { + "line": 7, + "column": 53 + } + }, + "range": [ + 372, + 373 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 54 + }, + "end": { + "line": 7, + "column": 55 + } + }, + "range": [ + 374, + 375 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 55 + }, + "end": { + "line": 7, + "column": 56 + } + }, + "range": [ + 375, + 376 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 7, + "column": 57 + }, + "end": { + "line": 7, + "column": 58 + } + }, + "range": [ + 377, + 378 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 7, + "column": 58 + }, + "end": { + "line": 7, + "column": 59 + } + }, + "range": [ + 378, + 379 + ] + }, + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "range": [ + 380, + 385 + ] + }, + { + "type": "Identifier", + "value": "d", + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 386, + 387 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "range": [ + 388, + 389 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 16 + } + }, + "range": [ + 390, + 396 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + }, + "range": [ + 396, + 397 + ] + }, + { + "type": "String", + "value": "\"foo.json\"", + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 27 + } + }, + "range": [ + 397, + 407 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + }, + "range": [ + 407, + 408 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 32 + } + }, + "range": [ + 409, + 412 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "range": [ + 413, + 414 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 8, + "column": 34 + }, + "end": { + "line": 8, + "column": 35 + } + }, + "range": [ + 414, + 415 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 6 + } + }, + "range": [ + 416, + 422 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + }, + "range": [ + 423, + 435 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 24 + } + }, + "range": [ + 436, + 440 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 26 + } + }, + "range": [ + 441, + 442 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "range": [ + 443, + 446 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + }, + "range": [ + 446, + 447 + ] + }, + { + "type": "String", + "value": "\"bar\"", + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "range": [ + 448, + 453 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 38 + }, + "end": { + "line": 9, + "column": 39 + } + }, + "range": [ + 454, + 455 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "range": [ + 455, + 456 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + }, + "range": [ + 485, + 491 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "range": [ + 492, + 504 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 24 + } + }, + "range": [ + 505, + 509 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 26 + } + }, + "range": [ + 510, + 511 + ] + }, + { + "type": "String", + "value": "\"type\"", + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 33 + } + }, + "range": [ + 512, + 518 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 10, + "column": 33 + }, + "end": { + "line": 10, + "column": 34 + } + }, + "range": [ + 518, + 519 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 10, + "column": 35 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "range": [ + 520, + 526 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 10, + "column": 42 + }, + "end": { + "line": 10, + "column": 43 + } + }, + "range": [ + 527, + 528 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 10, + "column": 43 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "range": [ + 528, + 529 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + }, + "range": [ + 550, + 556 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "range": [ + 557, + 569 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 24 + } + }, + "range": [ + 570, + 574 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + }, + "range": [ + 575, + 576 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "range": [ + 577, + 578 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 29 + } + }, + "range": [ + 578, + 579 + ] + }, + { + "type": "String", + "value": "\"a\"", + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 580, + 583 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + }, + "range": [ + 583, + 584 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 11, + "column": 35 + }, + "end": { + "line": 11, + "column": 36 + } + }, + "range": [ + 585, + 586 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 11, + "column": 36 + }, + "end": { + "line": 11, + "column": 37 + } + }, + "range": [ + 586, + 587 + ] + }, + { + "type": "String", + "value": "\"b\"", + "loc": { + "start": { + "line": 11, + "column": 38 + }, + "end": { + "line": 11, + "column": 41 + } + }, + "range": [ + 588, + 591 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 11, + "column": 42 + }, + "end": { + "line": 11, + "column": 43 + } + }, + "range": [ + 592, + 593 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 44 + } + }, + "range": [ + 593, + 594 + ] + }, + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 6 + } + }, + "range": [ + 624, + 630 + ] + }, + { + "type": "String", + "value": "\"./foo.json\"", + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 19 + } + }, + "range": [ + 631, + 643 + ] + }, + { + "type": "Keyword", + "value": "with", + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 24 + } + }, + "range": [ + 644, + 648 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 26 + } + }, + "range": [ + 649, + 650 + ] + }, + { + "type": "String", + "value": "\"type\"", + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 33 + } + }, + "range": [ + 651, + 657 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + }, + "range": [ + 657, + 658 + ] + }, + { + "type": "String", + "value": "\"json\"", + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 41 + } + }, + "range": [ + 659, + 665 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 12, + "column": 41 + }, + "end": { + "line": 12, + "column": 42 + } + }, + "range": [ + 665, + 666 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 12, + "column": 44 + }, + "end": { + "line": 12, + "column": 45 + } + }, + "range": [ + 668, + 669 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 12, + "column": 45 + }, + "end": { + "line": 12, + "column": 46 + } + }, + "range": [ + 669, + 670 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js new file mode 100644 index 00000000..521323ed --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.result.js @@ -0,0 +1,6 @@ +export default { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "'import' and 'export' may appear only with 'sourceType: module'" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js new file mode 100644 index 00000000..eef7bd04 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/import-attributes/valid-import-attributes.src.js @@ -0,0 +1,12 @@ +import json from "./foo.json" with { type: "json" }; +import "./foo.json" with { type: "json" }; +export {v} from "./foo.json" with { type: "json" }; +export * as json from "./foo.json" with { type: "json" }; +const a = import("foo.json", { with: { type: "json" } }); +const b = import("foo.json", ); // Allow trailing comma +const c = import("foo.json", { with: { type: "json" } }, ); +const d = import("foo.json", foo ); +import "./foo.json" with { foo: "bar" }; // Allow unknown attributes +import "./foo.json" with { "type": "json" }; // Allow string key +import "./foo.json" with { a: "a", b: "b" }; // Allow multiple attributes +import "./foo.json" with { "type": "json", }; // Allow trailing comma diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js new file mode 100644 index 00000000..240ddc09 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?ii:p)?/: Duplicate regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js new file mode 100644 index 00000000..b3d74b51 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-add-modifiers.src.js @@ -0,0 +1 @@ +/(?ii:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js new file mode 100644 index 00000000..e8c0f982 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?i-i:p)?/: Duplicate regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js new file mode 100644 index 00000000..d98be680 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-modifiers.src.js @@ -0,0 +1 @@ +/(?i-i:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js new file mode 100644 index 00000000..e2b0b179 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?-ii:p)?/: Duplicate regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js new file mode 100644 index 00000000..6100af90 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-dupe-remove-modifiers.src.js @@ -0,0 +1 @@ +/(?-ii:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js new file mode 100644 index 00000000..38ead2b6 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?-:p)?/: Invalid regular expression modifiers" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js new file mode 100644 index 00000000..f9ace52b --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-empty-modifiers.src.js @@ -0,0 +1 @@ +/(?-:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js new file mode 100644 index 00000000..d1299850 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.result.js @@ -0,0 +1,6 @@ +export default { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Invalid regular expression: /(?u:p)?/: Invalid group" +}; \ No newline at end of file diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js new file mode 100644 index 00000000..1f828c14 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/invalid-regexp-unknown-modifiers.src.js @@ -0,0 +1 @@ +/(?u:p)?/; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js new file mode 100644 index 00000000..dc0a7ae8 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.result.js @@ -0,0 +1,424 @@ +import conditionalRegex from "../../../../lib/conditional-regex-value.js"; + +export default { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "range": [ + 0, + 67 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "value": null, + "raw": "/(?i-m:p)?/", + "regex": { + "pattern": "(?i-m:p)?", + "flags": "" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 13, + 26 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 13, + 25 + ], + "value": null, + "raw": "/(?i-m:p)?/u", + "regex": { + "pattern": "(?i-m:p)?", + "flags": "u" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 27, + 39 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 27, + 38 + ], + "value": null, + "raw": "/(?ims:p)?/", + "regex": { + "pattern": "(?ims:p)?", + "flags": "" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 40, + 53 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 40, + 52 + ], + "value": null, + "raw": "/(?ims-:p)?/", + "regex": { + "pattern": "(?ims-:p)?", + "flags": "" + } + }) + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "range": [ + 54, + 67 + ], + "expression": conditionalRegex({ + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 54, + 66 + ], + "value": null, + "raw": "/(?-ims:p)?/", + "regex": { + "pattern": "(?-ims:p)?", + "flags": "" + } + }) + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "RegularExpression", + "value": "/(?i-m:p)?/", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "regex": { + "flags": "", + "pattern": "(?i-m:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "RegularExpression", + "value": "/(?i-m:p)?/u", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 13, + 25 + ], + "regex": { + "flags": "u", + "pattern": "(?i-m:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "RegularExpression", + "value": "/(?ims:p)?/", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 27, + 38 + ], + "regex": { + "flags": "", + "pattern": "(?ims:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "RegularExpression", + "value": "/(?ims-:p)?/", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 40, + 52 + ], + "regex": { + "flags": "", + "pattern": "(?ims-:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 52, + 53 + ] + }, + { + "type": "RegularExpression", + "value": "/(?-ims:p)?/", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 54, + 66 + ], + "regex": { + "flags": "", + "pattern": "(?-ims:p)?" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "range": [ + 66, + 67 + ] + } + ] +}; diff --git a/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js new file mode 100644 index 00000000..5ae7ebf7 --- /dev/null +++ b/packages/espree/tests/fixtures/ecma-version/16/regexp-modifiers/valid-regexp-modifiers.src.js @@ -0,0 +1,5 @@ +/(?i-m:p)?/; +/(?i-m:p)?/u; +/(?ims:p)?/; +/(?ims-:p)?/; +/(?-ims:p)?/; diff --git a/tools/update-readme.js b/tools/update-readme.js index 520a268c..a6df7ab6 100644 --- a/tools/update-readme.js +++ b/tools/update-readme.js @@ -11,129 +11,50 @@ //----------------------------------------------------------------------------- import { readFileSync, readdirSync, writeFileSync } from "node:fs"; -import { stripIndents } from "common-tags"; import got from "got"; //----------------------------------------------------------------------------- // Data //----------------------------------------------------------------------------- -const SPONSORS_URL = "https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/sponsors.json"; - -const TECH_SPONSORS_URL = "https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/techsponsors.json"; - -const TECH_SPONSORS_IMAGE_PATH = "https://raw.githubusercontent.com/eslint/eslint.org/main/src"; +const SPONSORS_URL = "https://raw.githubusercontent.com/eslint/eslint.org/main/includes/sponsors.md"; const README_FILE_PATHS = [ "./README.md", ...readdirSync("./packages").map(dir => `./packages/${dir}/README.md`) ]; -const heights = { - platinum: 128, - gold: 96, - silver: 64, - bronze: 32 -}; - //----------------------------------------------------------------------------- // Helpers //----------------------------------------------------------------------------- /** - * Fetches the latest sponsors data from the website. - * @returns {Object} The sponsors data object. - */ -async function fetchSponsorsData() { - const data = await got(SPONSORS_URL).json(); - - // remove backers from sponsors list - not shown on readme - delete data.backers; - - return data; -} - -/** - * Fetches the latest tech sponsors data from the website. - * @returns {Array} The tech sponsors array of data object. - */ -async function fetchTechSponsors() { - const data = await got(TECH_SPONSORS_URL).json(); - - return data; -} - -/** - * Formats an array of sponsors into HTML for the readme. - * @param {Object} sponsors The object of sponsors. - * @returns {string} The HTML for the readme. + * Fetches the latest sponsors from the website. + * @returns {Promise}} Prerendered sponsors markdown. */ -function formatSponsors(sponsors) { - const nonEmptySponsors = Object.keys(sponsors).filter( - tier => sponsors[tier].length > 0 - ); - - return stripIndents` - ${nonEmptySponsors - .map( - tier => `

${tier[0].toUpperCase()}${tier.slice(1)} Sponsors

-

${sponsors[tier] - .map( - sponsor => - `${sponsor.name}` - ) - .join(" ")}

` - ) - .join("")} - `; -} - -/** - * Formats an array of sponsors into HTML for the readme. - * @param {Array} sponsors The array of sponsors. - * @returns {string} The HTML for the readme. - */ -function formatTechSponsors(sponsors) { - return stripIndents` -

Technology Sponsors

-

${sponsors - .map( - sponsor => - `${sponsor.name}` - ) - .join(" ")}

- `; +async function fetchSponsorsMarkdown() { + return got(SPONSORS_URL).text(); } //----------------------------------------------------------------------------- // Main //----------------------------------------------------------------------------- -(async () => { - const [techSponsors, allSponsors] = await Promise.all([ - fetchTechSponsors(), - fetchSponsorsData() - ]); +const allSponsors = await fetchSponsorsMarkdown(); - README_FILE_PATHS.forEach(filePath => { +README_FILE_PATHS.forEach(filePath => { - // read readme file - const readme = readFileSync(filePath, "utf8"); + // read readme file + const readme = readFileSync(filePath, "utf8"); - let newReadme = readme.replace( - /[\w\W]*?/u, - formatSponsors(allSponsors) - ); - - newReadme = newReadme.replace( - /[\w\W]*?/u, - formatTechSponsors(techSponsors) - ); + let newReadme = readme.replace( + /[\w\W]*?/u, + `\n${allSponsors}\n` + ); - // replace multiple consecutive blank lines with just one blank line - newReadme = newReadme.replace(/(?<=^|\n)\n{2,}/gu, "\n"); + // replace multiple consecutive blank lines with just one blank line + newReadme = newReadme.replace(/(?<=^|\n)\n{2,}/gu, "\n"); - // output to the files - writeFileSync(filePath, newReadme, "utf8"); - }); -})(); + // output to the files + writeFileSync(filePath, newReadme, "utf8"); +}); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy