Skip to content

Commit 29aaafe

Browse files
chore: wip
1 parent 5371026 commit 29aaafe

File tree

17 files changed

+4285
-4744
lines changed

17 files changed

+4285
-4744
lines changed

packages/eui/.babelrc-optimize.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/eui/.babelrc-test-env.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/eui/.babelrc.js

Lines changed: 12 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,19 @@
11
module.exports = {
2-
// We need to preserve comments as they are used by webpack for
3-
// naming chunks during code-splitting. The compression step during
4-
// bundling will remove them later.
5-
"comments": true,
6-
7-
"presets": [
8-
["@babel/env", {
9-
// `targets` property set via `.browserslistrc`
10-
"useBuiltIns": process.env.NO_COREJS_POLYFILL ? false : "usage",
11-
"corejs": !process.env.NO_COREJS_POLYFILL ? '3.6' : undefined,
12-
"modules": process.env.BABEL_MODULES ? process.env.BABEL_MODULES === 'false' ? false : process.env.BABEL_MODULES : "commonjs" // babel's default is commonjs
13-
}],
14-
["@babel/react", { runtime: 'classic' }],
15-
["@babel/typescript", { isTSX: true, allExtensions: true, allowDeclareFields: true }],
2+
presets: [
3+
['@babel/react', { runtime: 'classic' }],
164
[
17-
"@emotion/babel-preset-css-prop",
18-
{
19-
"autoLabel": "always",
20-
"labelFormat": "[local]",
21-
"sourceMap": false,
22-
},
5+
'@babel/typescript',
6+
{ isTSX: true, allExtensions: true, allowDeclareFields: true },
237
],
8+
'@emotion/babel-preset-css-prop',
249
],
25-
"plugins": [
26-
`${__dirname}/scripts/babel/proptypes-from-ts-props`,
27-
"add-module-exports",
28-
// stage 3
29-
"@babel/proposal-object-rest-spread",
30-
// stage 2
31-
"@babel/proposal-class-properties",
32-
[
33-
"inline-react-svg",
34-
{
35-
"ignorePattern": "images/*",
36-
"svgo": {
37-
"plugins": [
38-
{ "cleanupIDs": false },
39-
{ "removeViewBox": false }
40-
]
41-
}
42-
}
43-
],
10+
plugins: [
11+
'@babel/proposal-object-rest-spread',
12+
'@babel/proposal-class-properties',
4413
],
45-
// Used for Cypress code coverage - note that the env has to be Cypress-specific, otherwise Jest --coverage throws errors
46-
"env": {
47-
"cypress_test": {
48-
"plugins": ["istanbul"]
49-
}
14+
env: {
15+
cypress_test: {
16+
plugins: ['istanbul'],
17+
},
5018
},
51-
"overrides": [
52-
{
53-
"include": `${__dirname}/src/components/search_bar/query/default_syntax.ts`,
54-
"plugins": ["pegjs-inline-precompile"],
55-
}
56-
]
5719
};

packages/eui/.browserslistrc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
last 2 versions
22
not dead
33
not IE 11
4-
Safari 7
5-
# adding as part of Storybook upgrade to v8 https://github.com/babel/babel/issues/16171#issuecomment-2015227043
6-
not op_mob >= 1
7-
8-
# Safari 7 for PhantomJS support

packages/eui/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ node_modules
2525
**/*.out
2626
.eslintcache
2727
.yo-rc.json
28+
.swc
2829

2930
# TypeScript output
3031
/types

packages/eui/.swcrc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"$schema": "https://swc.rs/schema.json",
3+
"env": {
4+
"targets": [
5+
"last 2 versions",
6+
"not dead",
7+
"not IE 11"
8+
]
9+
},
10+
"jsc": {
11+
"parser": {
12+
"syntax": "typescript",
13+
"tsx": true
14+
},
15+
"transform": {
16+
"react": {
17+
"runtime": "automatic",
18+
"importSource": "@emotion/react"
19+
}
20+
},
21+
"externalHelpers": false,
22+
"preserveAllComments": true,
23+
"experimental": {
24+
"plugins": [
25+
[
26+
"@swc/plugin-emotion",
27+
{
28+
"autoLabel": "always",
29+
"labelFormat": "[local]",
30+
"sourceMap": false
31+
}
32+
]
33+
]
34+
}
35+
},
36+
"module": {
37+
"type": "commonjs"
38+
}
39+
}

packages/eui/cypress/webpack.config.js

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,43 @@ module.exports = {
4040
rules: [
4141
{
4242
test: /\.(js|tsx?)$/,
43-
loader: 'babel-loader',
43+
loader: 'swc-loader',
4444
exclude: /node_modules/,
4545
sideEffects: true, // tells webpack not to tree shake `import './'` lines
4646
options: {
47-
plugins: ['istanbul'],
47+
jsc: {
48+
parser: {
49+
syntax: 'typescript',
50+
tsx: true,
51+
},
52+
transform: {
53+
react: {
54+
runtime: 'classic',
55+
importSource: '@emotion/react',
56+
},
57+
},
58+
externalHelpers: false,
59+
preserveAllComments: true,
60+
experimental: {
61+
plugins: [
62+
[
63+
'@swc/plugin-emotion',
64+
{
65+
autoLabel: 'always',
66+
labelFormat: '[local]',
67+
sourceMap: false,
68+
},
69+
],
70+
['swc-plugin-coverage-instrument', {}],
71+
],
72+
},
73+
},
74+
env: {
75+
targets: ['last 2 versions', 'not dead', 'not IE 11'],
76+
},
77+
module: {
78+
type: 'es6',
79+
},
4880
},
4981
},
5082
],

packages/eui/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"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",
2020
"build:clean": "rimraf dist lib es optimize test-env eui.d.ts",
2121
"build:i18ntokens": "node ./scripts/build_i18ntokens.mjs",
22-
"build": "yarn build:clean && yarn build:i18ntokens && node ./scripts/compile-eui.js",
22+
"build:query-parser": "pegjs -o src/components/search_bar/query/query_parser.js src/components/search_bar/query/query.pegjs",
23+
"build": "yarn build:clean && yarn build:i18ntokens && yarn build:query-parser && node ./scripts/compile-eui.js",
2324
"build-pack": "yarn build && yarn pack",
2425
"compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.tsx\"",
2526
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-css-in-js && yarn lint-sass",
@@ -55,6 +56,7 @@
5556
"@elastic/eui-theme-common": "workspace:*",
5657
"@elastic/prismjs-esql": "^1.1.2",
5758
"@hello-pangea/dnd": "^16.6.0",
59+
"@swc/helpers": "^0.5.17",
5860
"@types/lodash": "^4.14.202",
5961
"@types/numeral": "^2.0.5",
6062
"@types/react-window": "^1.8.8",
@@ -93,8 +95,6 @@
9395
"@babel/core": "^7.21.8",
9496
"@babel/plugin-proposal-class-properties": "^7.18.6",
9597
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
96-
"@babel/plugin-transform-async-to-generator": "^7.20.7",
97-
"@babel/plugin-transform-runtime": "^7.21.4",
9898
"@babel/preset-env": "^7.21.5",
9999
"@babel/preset-react": "^7.18.6",
100100
"@babel/preset-typescript": "^7.21.5",
@@ -131,6 +131,10 @@
131131
"@svgr/core": "8.0.0",
132132
"@svgr/plugin-jsx": "^8.0.1",
133133
"@svgr/plugin-svgo": "^8.0.1",
134+
"@swc/cli": "^0.7.9",
135+
"@swc/core": "^1.15.2",
136+
"@swc/jest": "^0.2.39",
137+
"@swc/plugin-emotion": "^13.0.0",
134138
"@testing-library/jest-dom": "^5.16.3",
135139
"@testing-library/react": "^14.0.0",
136140
"@testing-library/react-17": "npm:@testing-library/react@^12.1.5",
@@ -160,9 +164,6 @@
160164
"babel-jest": "^29.7.0",
161165
"babel-loader": "^9.1.2",
162166
"babel-plugin-add-module-exports": "^1.0.4",
163-
"babel-plugin-inline-react-svg": "^2.0.2",
164-
"babel-plugin-istanbul": "^6.1.1",
165-
"babel-plugin-pegjs-inline-precompile": "^0.1.1",
166167
"buffer": "^6.0.3",
167168
"buildkite-test-collector": "^1.7.2",
168169
"cache-loader": "^4.1.0",
@@ -244,6 +245,8 @@
244245
"stylelint-config-prettier-scss": "^1.0.0",
245246
"stylelint-config-standard": "^33.0.0",
246247
"stylelint-config-standard-scss": "^9.0.0",
248+
"swc-loader": "^0.2.6",
249+
"swc-plugin-coverage-instrument": "^0.0.32",
247250
"terser-webpack-plugin": "^5.3.5",
248251
"typescript": "^5.8.3",
249252
"uglifyjs-webpack-plugin": "^2.2.0",

0 commit comments

Comments
 (0)