Skip to content

Commit

Permalink
acorn options rename
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Dec 1, 2024
1 parent 0a31c98 commit 652d823
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/lib/parsing-utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const acornOptions = {
const ACORN_OPTIONS = {
ecmaVersion: 'latest',
sourceType: 'module'
};

export {
acornOptions
ACORN_OPTIONS
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ResourceInterface } from '../../lib/resource-interface.js';
import terser from '@rollup/plugin-terser';
import * as acorn from 'acorn';
import * as walk from 'acorn-walk';
import { acornOptions } from '../../lib/parsing-utils.js';
import { ACORN_OPTIONS } from '../../lib/parsing-utils.js';

class StandardJavaScriptResource extends ResourceInterface {
constructor(compilation, options) {
Expand Down Expand Up @@ -43,7 +43,7 @@ class StandardJavaScriptResource extends ResourceInterface {
const body = await response.clone().text();
let polyfilled = body;

walk.simple(acorn.parse(body, acornOptions), {
walk.simple(acorn.parse(body, ACORN_OPTIONS), {
async ImportDeclaration(node) {
const line = body.slice(node.start, node.end);
const { value } = node.source;
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-css-modules/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as acornWalk from 'acorn-walk';
import * as acorn from 'acorn';
import { hashString } from '@greenwood/cli/src/lib/hashing-utils.js';
import { transform } from 'sucrase';
import { acornOptions } from '@greenwood/cli/src/lib/parsing-utils.js';
import { ACORN_OPTIONS } from '@greenwood/cli/src/lib/parsing-utils.js';

const MODULES_MAP_FILENAME = '__css-modules-map.json';
/*
Expand Down Expand Up @@ -40,7 +40,7 @@ function walkAllImportsForCssModules(scriptUrl, sheets, compilation) {
});

acornWalk.simple(
acorn.parse(result.code, acornOptions), {
acorn.parse(result.code, ACORN_OPTIONS), {
ImportDeclaration(node) {
const { specifiers = [], source = {} } = node;
const { value = '' } = source;
Expand Down Expand Up @@ -242,7 +242,7 @@ class StripCssModulesResource extends ResourceInterface {
let contents = await response.text();

acornWalk.simple(
acorn.parse(contents, acornOptions), {
acorn.parse(contents, ACORN_OPTIONS), {
ImportDeclaration(node) {
const { specifiers = [], source = {}, start, end } = node;
const { value = '' } = source;
Expand Down

0 comments on commit 652d823

Please sign in to comment.