Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Remove "@babel/traverse" dependency
Browse files Browse the repository at this point in the history
Used only as types which are also available from @babel/core. This
ensures the types don't get out of sync since @babel/core is sometimes
listed as a peer dependency (web-worker).
  • Loading branch information
jesstelford committed Sep 12, 2024
1 parent 408f6be commit 3a1077c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-hotels-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/web-worker': patch
---

Ensure the correct babel types are used internally
1 change: 0 additions & 1 deletion packages/async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"devDependencies": {
"@babel/core": ">=7.0.0",
"@babel/plugin-syntax-dynamic-import": ">=7.0.0",
"@babel/traverse": ">=7.23.2",
"@babel/types": ">=7.0.0",
"@types/babel__core": ">=7.0.0",
"@types/babel__traverse": ">=7.0.0"
Expand Down
4 changes: 3 additions & 1 deletion packages/async/src/babel-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type Types from '@babel/types';
import type {NodePath, Binding} from '@babel/traverse';
import type {NodePath, BabelFile} from '@babel/core';

type Binding = BabelFile['scope']['bindings'][string];

/* eslint-disable @typescript-eslint/naming-convention */
const DEFAULT_PACKAGES_TO_PROCESS = {
Expand Down
1 change: 0 additions & 1 deletion packages/react-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
},
"optionalDependencies": {
"@babel/template": "^7.0.0",
"@babel/traverse": "^7.23.2",
"fs-extra": "^9.1.0"
},
"files": [
Expand Down
3 changes: 1 addition & 2 deletions packages/react-i18n/src/babel-plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import path from 'path';
import glob from 'glob';
import stringHash from 'string-hash';
import {camelCase} from 'change-case';
import type {BabelFile} from '@babel/core';
import type {Node, NodePath, BabelFile} from '@babel/core';
import type {TemplateBuilder} from '@babel/template';
import type Types from '@babel/types';
import type {Node, NodePath} from '@babel/traverse';

import {
fallbackTranslationsImport,
Expand Down
5 changes: 4 additions & 1 deletion packages/web-worker/src/babel-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import {resolve} from 'path';
import {runInNewContext} from 'vm';

import type {NodePath, Binding} from '@babel/traverse';
import type {
PluginObj,
BabelFile,
NodePath,
types as babelTypes,
template as babelTemplate,
} from '@babel/core';

import type {Options as LoaderOptions} from './webpack-parts/loader';

type Binding = BabelFile['scope']['bindings'][string];

export const DEFAULT_PACKAGES_TO_PROCESS = {
// eslint-disable-next-line @typescript-eslint/naming-convention
'@shopify/web-worker': [
Expand Down
21 changes: 18 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@
"@babel/parser" "^7.24.7"
"@babel/types" "^7.24.7"

"@babel/traverse@>=7.23.2", "@babel/traverse@^7.1.6", "@babel/traverse@^7.12.11", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.17.3", "@babel/traverse@^7.17.9", "@babel/traverse@^7.23.2", "@babel/traverse@^7.24.7", "@babel/traverse@^7.7.2":
"@babel/traverse@^7.1.6", "@babel/traverse@^7.12.11", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.17.3", "@babel/traverse@^7.17.9", "@babel/traverse@^7.24.7", "@babel/traverse@^7.7.2":
version "7.24.7"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.7.tgz#de2b900163fa741721ba382163fe46a936c40cf5"
integrity sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==
Expand Down Expand Up @@ -12672,7 +12672,15 @@ react-docgen@^5.0.0:
node-dir "^0.1.10"
strip-indent "^3.0.0"

"react-dom18@npm:react-dom@^18.1.0", react-dom@^18.1.0:
"react-dom18@npm:react-dom@^18.1.0":
version "18.1.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.1.0.tgz#7f6dd84b706408adde05e1df575b3a024d7e8a2f"
integrity sha512-fU1Txz7Budmvamp7bshe4Zi32d0ll7ect+ccxNu9FlObT605GOEB8BfO4tmRJ39R5Zj831VCpvQ05QPBW5yb+w==
dependencies:
loose-envify "^1.1.0"
scheduler "^0.22.0"

react-dom@^18.1.0:
version "18.1.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.1.0.tgz#7f6dd84b706408adde05e1df575b3a024d7e8a2f"
integrity sha512-fU1Txz7Budmvamp7bshe4Zi32d0ll7ect+ccxNu9FlObT605GOEB8BfO4tmRJ39R5Zj831VCpvQ05QPBW5yb+w==
Expand Down Expand Up @@ -12731,7 +12739,14 @@ react-router@6.4.0:
dependencies:
"@remix-run/router" "1.0.0"

"react18@npm:react@^18.1.0", react@^18.1.0:
"react18@npm:react@^18.1.0":
version "18.1.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
dependencies:
loose-envify "^1.1.0"

react@^18.1.0:
version "18.1.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
Expand Down

0 comments on commit 3a1077c

Please sign in to comment.