Unverified Commit 7f54585f authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Bump styled-jsx and remove manual types creation (#39506)

parent d158c0c5
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
"string-hash": "1.1.3", "string-hash": "1.1.3",
"string_decoder": "1.3.0", "string_decoder": "1.3.0",
"strip-ansi": "6.0.0", "strip-ansi": "6.0.0",
"styled-jsx": "5.0.3", "styled-jsx": "5.0.4",
"tar": "6.1.11", "tar": "6.1.11",
"taskr": "1.1.0", "taskr": "1.1.0",
"terser": "5.14.1", "terser": "5.14.1",
......
...@@ -56,33 +56,13 @@ export async function copy_styled_jsx_assets(task, opts) { ...@@ -56,33 +56,13 @@ export async function copy_styled_jsx_assets(task, opts) {
// Separate type files into different folders to avoid conflicts between // Separate type files into different folders to avoid conflicts between
// dev dep `styled-jsx` and `next/dist/styled-jsx` for duplicated declare modules // dev dep `styled-jsx` and `next/dist/styled-jsx` for duplicated declare modules
const typesDir = join(outputDir, 'types') const typesDir = join(outputDir, 'types')
let typeReferences = ''
let globalTypesContent = ''
await fs.ensureDir(outputDir)
await fs.ensureDir(typesDir) await fs.ensureDir(typesDir)
for (const file of typeFiles) { for (const file of typeFiles) {
const fileNoExt = file.replace(/\.d\.ts/, '') const content = await fs.readFile(join(styledJsxPath, file), 'utf8')
let content = await fs.readFile(join(styledJsxPath, file), 'utf8')
if (file === 'index.d.ts') {
const styledJsxIdx = content.indexOf(`declare module 'styled-jsx' {`)
globalTypesContent = content.substring(0, styledJsxIdx)
content = content
.substring(styledJsxIdx)
.replace('React.', `import('react').`)
}
await fs.writeFile(join(typesDir, file), content) await fs.writeFile(join(typesDir, file), content)
typeReferences += `/// <reference types="./${fileNoExt}" />\n`
} }
await fs.writeFile(
join(typesDir, 'global.d.ts'),
`${typeReferences}\n${globalTypesContent}`
)
for (const file of jsFiles) { for (const file of jsFiles) {
const content = await fs.readFile(join(styledJsxPath, file), 'utf8') const content = await fs.readFile(join(styledJsxPath, file), 'utf8')
const distFile = join(outputDir, file) const distFile = join(outputDir, file)
......
...@@ -561,7 +561,7 @@ importers: ...@@ -561,7 +561,7 @@ importers:
string_decoder: 1.3.0 string_decoder: 1.3.0
string-hash: 1.1.3 string-hash: 1.1.3
strip-ansi: 6.0.0 strip-ansi: 6.0.0
styled-jsx: 5.0.3 styled-jsx: 5.0.4
tar: 6.1.11 tar: 6.1.11
taskr: 1.1.0 taskr: 1.1.0
terser: 5.14.1 terser: 5.14.1
...@@ -750,7 +750,7 @@ importers: ...@@ -750,7 +750,7 @@ importers:
string_decoder: 1.3.0 string_decoder: 1.3.0
string-hash: 1.1.3 string-hash: 1.1.3
strip-ansi: 6.0.0 strip-ansi: 6.0.0
styled-jsx: 5.0.3_@babel+core@7.18.0 styled-jsx: 5.0.4_@babel+core@7.18.0
tar: 6.1.11 tar: 6.1.11
taskr: 1.1.0 taskr: 1.1.0
terser: 5.14.1 terser: 5.14.1
...@@ -10454,6 +10454,7 @@ packages: ...@@ -10454,6 +10454,7 @@ packages:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0
dependencies: dependencies:
eslint: 7.32.0 eslint: 7.32.0
dev: false
/eslint-plugin-react/7.23.2_eslint@7.24.0: /eslint-plugin-react/7.23.2_eslint@7.24.0:
resolution: {integrity: sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==} resolution: {integrity: sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==}
...@@ -18448,7 +18449,7 @@ packages: ...@@ -18448,7 +18449,7 @@ packages:
dev: true dev: true
/querystring/0.2.0: /querystring/0.2.0:
resolution: {integrity: sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==} resolution: {integrity: sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=}
engines: {node: '>=0.4.x'} engines: {node: '>=0.4.x'}
deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
dev: true dev: true
...@@ -20559,8 +20560,8 @@ packages: ...@@ -20559,8 +20560,8 @@ packages:
postcss-load-plugins: 2.3.0 postcss-load-plugins: 2.3.0
dev: true dev: true
/styled-jsx/5.0.3_@babel+core@7.18.0: /styled-jsx/5.0.4_@babel+core@7.18.0:
resolution: {integrity: sha512-v82oihjxFj2WJtQiodZIDjJpnmVcE71HTCVylxdcQHU0ocnI0rGhJ0+5A3311NMQUx0KFJ+18RSHNlfIgcSU8g==} resolution: {integrity: sha512-sDFWLbg4zR+UkNzfk5lPilyIgtpddfxXEULxhujorr5jtePTUqiPDc5BC0v1NRqTr/WaFBGQQUoYToGlF4B2KQ==}
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
peerDependencies: peerDependencies:
'@babel/core': '*' '@babel/core': '*'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment