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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions packages/eui/.babelrc-optimize.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/eui/.babelrc-test-env.js

This file was deleted.

62 changes: 12 additions & 50 deletions packages/eui/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,19 @@
module.exports = {
// We need to preserve comments as they are used by webpack for
// naming chunks during code-splitting. The compression step during
// bundling will remove them later.
"comments": true,

"presets": [
["@babel/env", {
// `targets` property set via `.browserslistrc`
"useBuiltIns": process.env.NO_COREJS_POLYFILL ? false : "usage",
"corejs": !process.env.NO_COREJS_POLYFILL ? '3.6' : undefined,
"modules": process.env.BABEL_MODULES ? process.env.BABEL_MODULES === 'false' ? false : process.env.BABEL_MODULES : "commonjs" // babel's default is commonjs
}],
["@babel/react", { runtime: 'classic' }],
["@babel/typescript", { isTSX: true, allExtensions: true, allowDeclareFields: true }],
presets: [
['@babel/react', { runtime: 'classic' }],
[
"@emotion/babel-preset-css-prop",
{
"autoLabel": "always",
"labelFormat": "[local]",
"sourceMap": false,
},
'@babel/typescript',
{ isTSX: true, allExtensions: true, allowDeclareFields: true },
],
'@emotion/babel-preset-css-prop',
],
"plugins": [
`${__dirname}/scripts/babel/proptypes-from-ts-props`,
"add-module-exports",
// stage 3
"@babel/proposal-object-rest-spread",
// stage 2
"@babel/proposal-class-properties",
[
"inline-react-svg",
{
"ignorePattern": "images/*",
"svgo": {
"plugins": [
{ "cleanupIDs": false },
{ "removeViewBox": false }
]
}
}
],
plugins: [
'@babel/proposal-object-rest-spread',
'@babel/proposal-class-properties',
],
// Used for Cypress code coverage - note that the env has to be Cypress-specific, otherwise Jest --coverage throws errors
"env": {
"cypress_test": {
"plugins": ["istanbul"]
}
env: {
cypress_test: {
plugins: ['istanbul'],
},
},
"overrides": [
{
"include": `${__dirname}/src/components/search_bar/query/default_syntax.ts`,
"plugins": ["pegjs-inline-precompile"],
}
]
};
5 changes: 0 additions & 5 deletions packages/eui/.browserslistrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
last 2 versions
not dead
not IE 11
Safari 7
# adding as part of Storybook upgrade to v8 https://github.com/babel/babel/issues/16171#issuecomment-2015227043
not op_mob >= 1

# Safari 7 for PhantomJS support
1 change: 1 addition & 0 deletions packages/eui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ node_modules
**/*.out
.eslintcache
.yo-rc.json
.swc

# TypeScript output
/types
Expand Down
39 changes: 39 additions & 0 deletions packages/eui/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://swc.rs/schema.json",
"env": {
"targets": [
"last 2 versions",
"not dead",
"not IE 11"
]
},
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
},
"transform": {
"react": {
"runtime": "automatic",
"importSource": "@emotion/react"
}
},
"externalHelpers": false,
"preserveAllComments": true,
"experimental": {
"plugins": [
[
"@swc/plugin-emotion",
{
"autoLabel": "always",
"labelFormat": "[local]",
"sourceMap": false
}
]
]
}
},
"module": {
"type": "commonjs"
}
}
36 changes: 34 additions & 2 deletions packages/eui/cypress/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,43 @@ module.exports = {
rules: [
{
test: /\.(js|tsx?)$/,
loader: 'babel-loader',
loader: 'swc-loader',
exclude: /node_modules/,
sideEffects: true, // tells webpack not to tree shake `import './'` lines
options: {
plugins: ['istanbul'],
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
runtime: 'classic',
importSource: '@emotion/react',
},
},
externalHelpers: false,
preserveAllComments: true,
experimental: {
plugins: [
[
'@swc/plugin-emotion',
{
autoLabel: 'always',
labelFormat: '[local]',
sourceMap: false,
},
],
['swc-plugin-coverage-instrument', {}],
],
},
},
env: {
targets: ['last 2 versions', 'not dead', 'not IE 11'],
},
module: {
type: 'es6',
},
},
},
],
Expand Down
15 changes: 9 additions & 6 deletions packages/eui/package.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleanup babel dependencies

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"build:workspaces": "yarn workspaces foreach -Rti --from @elastic/eui-theme-common run build && yarn workspaces foreach -Rti --from @elastic/eui --exclude @elastic/eui --exclude @elastic/eui-theme-common run build",
"build:clean": "rimraf dist lib es optimize test-env eui.d.ts",
"build:i18ntokens": "node ./scripts/build_i18ntokens.mjs",
"build": "yarn build:clean && yarn build:i18ntokens && node ./scripts/compile-eui.js",
"build:query-parser": "pegjs -o src/components/search_bar/query/query_parser.js src/components/search_bar/query/query.pegjs",
"build": "yarn build:clean && yarn build:i18ntokens && yarn build:query-parser && node ./scripts/compile-eui.js",
"build-pack": "yarn build && yarn pack",
"compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.tsx\"",
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-css-in-js && yarn lint-sass",
Expand Down Expand Up @@ -55,6 +56,7 @@
"@elastic/eui-theme-common": "workspace:*",
"@elastic/prismjs-esql": "^1.1.2",
"@hello-pangea/dnd": "^16.6.0",
"@swc/helpers": "^0.5.17",
"@types/lodash": "^4.14.202",
"@types/numeral": "^2.0.5",
"@types/react-window": "^1.8.8",
Expand Down Expand Up @@ -93,8 +95,6 @@
"@babel/core": "^7.21.8",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-async-to-generator": "^7.20.7",
"@babel/plugin-transform-runtime": "^7.21.4",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
Expand Down Expand Up @@ -131,6 +131,10 @@
"@svgr/core": "8.0.0",
"@svgr/plugin-jsx": "^8.0.1",
"@svgr/plugin-svgo": "^8.0.1",
"@swc/cli": "^0.7.9",
"@swc/core": "^1.15.2",
"@swc/jest": "^0.2.39",
"@swc/plugin-emotion": "^13.0.0",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^14.0.0",
"@testing-library/react-17": "npm:@testing-library/react@^12.1.5",
Expand Down Expand Up @@ -160,9 +164,6 @@
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.2",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-inline-react-svg": "^2.0.2",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-pegjs-inline-precompile": "^0.1.1",
"buffer": "^6.0.3",
"buildkite-test-collector": "^1.7.2",
"cache-loader": "^4.1.0",
Expand Down Expand Up @@ -244,6 +245,8 @@
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-standard": "^33.0.0",
"stylelint-config-standard-scss": "^9.0.0",
"swc-loader": "^0.2.6",
"swc-plugin-coverage-instrument": "^0.0.32",
"terser-webpack-plugin": "^5.3.5",
"typescript": "^5.8.3",
"uglifyjs-webpack-plugin": "^2.2.0",
Expand Down
Loading
Loading