From dc0622c30854a85bcdf136c9e2c058a971702ed8 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Thu, 11 Aug 2022 16:43:10 +0200 Subject: [PATCH] Bump styled-jsx and remove manual types creation --- packages/next/package.json | 2 +- packages/next/taskfile.js | 22 +--------------------- pnpm-lock.yaml | 11 ++++++----- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/packages/next/package.json b/packages/next/package.json index 136713fd5454..74050871cbe2 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -257,7 +257,7 @@ "string-hash": "1.1.3", "string_decoder": "1.3.0", "strip-ansi": "6.0.0", - "styled-jsx": "5.0.3", + "styled-jsx": "5.0.4", "tar": "6.1.11", "taskr": "1.1.0", "terser": "5.14.1", diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index b38d7f37756a..88dde0b576a2 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -56,33 +56,13 @@ export async function copy_styled_jsx_assets(task, opts) { // Separate type files into different folders to avoid conflicts between // dev dep `styled-jsx` and `next/dist/styled-jsx` for duplicated declare modules const typesDir = join(outputDir, 'types') - let typeReferences = '' - let globalTypesContent = '' - - await fs.ensureDir(outputDir) await fs.ensureDir(typesDir) for (const file of typeFiles) { - const fileNoExt = file.replace(/\.d\.ts/, '') - 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').`) - } - + const content = await fs.readFile(join(styledJsxPath, file), 'utf8') await fs.writeFile(join(typesDir, file), content) - typeReferences += `/// \n` } - await fs.writeFile( - join(typesDir, 'global.d.ts'), - `${typeReferences}\n${globalTypesContent}` - ) - for (const file of jsFiles) { const content = await fs.readFile(join(styledJsxPath, file), 'utf8') const distFile = join(outputDir, file) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac3871730575..69701992ee3a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -561,7 +561,7 @@ importers: string_decoder: 1.3.0 string-hash: 1.1.3 strip-ansi: 6.0.0 - styled-jsx: 5.0.3 + styled-jsx: 5.0.4 tar: 6.1.11 taskr: 1.1.0 terser: 5.14.1 @@ -750,7 +750,7 @@ importers: string_decoder: 1.3.0 string-hash: 1.1.3 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 taskr: 1.1.0 terser: 5.14.1 @@ -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 dependencies: eslint: 7.32.0 + dev: false /eslint-plugin-react/7.23.2_eslint@7.24.0: resolution: {integrity: sha512-AfjgFQB+nYszudkxRkTFu0UR1zEQig0ArVMPloKhxwlwkzaw/fBiH0QWcBBhZONlXqQC51+nfqFrkn4EzHcGBw==} @@ -18448,7 +18449,7 @@ packages: dev: true /querystring/0.2.0: - resolution: {integrity: sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==} + resolution: {integrity: sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=} engines: {node: '>=0.4.x'} deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. dev: true @@ -20559,8 +20560,8 @@ packages: postcss-load-plugins: 2.3.0 dev: true - /styled-jsx/5.0.3_@babel+core@7.18.0: - resolution: {integrity: sha512-v82oihjxFj2WJtQiodZIDjJpnmVcE71HTCVylxdcQHU0ocnI0rGhJ0+5A3311NMQUx0KFJ+18RSHNlfIgcSU8g==} + /styled-jsx/5.0.4_@babel+core@7.18.0: + resolution: {integrity: sha512-sDFWLbg4zR+UkNzfk5lPilyIgtpddfxXEULxhujorr5jtePTUqiPDc5BC0v1NRqTr/WaFBGQQUoYToGlF4B2KQ==} engines: {node: '>= 12.0.0'} peerDependencies: '@babel/core': '*'