From 8c368884d739ad6bc8f6008393c7abee50d8b32d Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Mon, 7 Aug 2023 21:04:16 +0200 Subject: [PATCH 1/3] Update transform imports for lucide-react --- packages/next/src/server/config.ts | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/next/src/server/config.ts b/packages/next/src/server/config.ts index d1a41d9c5bfc3..a6e859217f4b6 100644 --- a/packages/next/src/server/config.ts +++ b/packages/next/src/server/config.ts @@ -686,39 +686,41 @@ function assignDefaults( transform: { // Special aliases '(SortAsc|LucideSortAsc|SortAscIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/arrow-up-narrow-wide!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/arrow-up-narrow-wide!lucide-react', '(SortDesc|LucideSortDesc|SortDescIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/arrow-down-wide-narrow!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/arrow-down-wide-narrow!lucide-react', '(Verified|LucideVerified|VerifiedIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/badge-check!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/badge-check!lucide-react', '(Slash|LucideSlash|SlashIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/ban!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/ban!lucide-react', '(CurlyBraces|LucideCurlyBraces|CurlyBracesIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/braces!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/braces!lucide-react', '(CircleSlashed|LucideCircleSlashed|CircleSlashedIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/circle-slash-2!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/circle-slash-2!lucide-react', '(SquareGantt|LucideSquareGantt|SquareGanttIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/gantt-chart-square!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/gantt-chart-square!lucide-react', '(SquareKanbanDashed|LucideSquareKanbanDashed|SquareKanbanDashedIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/kanban-square-dashed!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/kanban-square-dashed!lucide-react', '(SquareKanban|LucideSquareKanban|SquareKanbanIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/kanban-square!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/kanban-square!lucide-react', '(Edit3|LucideEdit3|Edit3Icon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/pen-line!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen-line!lucide-react', '(Edit|LucideEdit|EditIcon|PenBox|LucidePenBox|PenBoxIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/pen-square!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen-square!lucide-react', '(Edit2|LucideEdit2|Edit2Icon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/pen!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen!lucide-react', '(Stars|LucideStars|StarsIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/sparkles!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/sparkles!lucide-react', '(TextSelection|LucideTextSelection|TextSelectionIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/text-select!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/text-select!lucide-react', // General rules 'Lucide(.*)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/{{ kebabCase memberMatches.[1] }}!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase memberMatches.[1] }}!lucide-react', '(.*)Icon': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/{{ kebabCase memberMatches.[1] }}!lucide-react', - '*': 'modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/{{ kebabCase member }}!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase memberMatches.[1] }}!lucide-react', + '(.*)Icon': + 'lodash-es/{{member}}', + '*': 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase member }}!lucide-react', }, }, ramda: { From 4522c2750dfba09da05dd1b4e26219c0923873da Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Mon, 7 Aug 2023 21:24:37 +0200 Subject: [PATCH 2/3] update test --- test/development/basic/modularize-imports.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/development/basic/modularize-imports.test.ts b/test/development/basic/modularize-imports.test.ts index a9c0814f0a6df..4e115c8688dcc 100644 --- a/test/development/basic/modularize-imports.test.ts +++ b/test/development/basic/modularize-imports.test.ts @@ -11,7 +11,7 @@ describe('modularize-imports', () => { app: new FileRef(join(__dirname, 'modularize-imports/app')), }, dependencies: { - 'lucide-react': '0.263.1', + 'lucide-react': '0.264.0', }, }) }) From b00bfc96267a89286fb963798652e1a5add2ba9c Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Mon, 7 Aug 2023 21:26:36 +0200 Subject: [PATCH 3/3] revert duplicated name --- packages/next/src/server/config.ts | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/packages/next/src/server/config.ts b/packages/next/src/server/config.ts index a6e859217f4b6..52b82bec48760 100644 --- a/packages/next/src/server/config.ts +++ b/packages/next/src/server/config.ts @@ -686,40 +686,38 @@ function assignDefaults( transform: { // Special aliases '(SortAsc|LucideSortAsc|SortAscIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/arrow-up-narrow-wide!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/arrow-up-narrow-wide!lucide-react', '(SortDesc|LucideSortDesc|SortDescIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/arrow-down-wide-narrow!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/arrow-down-wide-narrow!lucide-react', '(Verified|LucideVerified|VerifiedIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/badge-check!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/badge-check!lucide-react', '(Slash|LucideSlash|SlashIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/ban!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/ban!lucide-react', '(CurlyBraces|LucideCurlyBraces|CurlyBracesIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/braces!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/braces!lucide-react', '(CircleSlashed|LucideCircleSlashed|CircleSlashedIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/circle-slash-2!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/circle-slash-2!lucide-react', '(SquareGantt|LucideSquareGantt|SquareGanttIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/gantt-chart-square!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/gantt-chart-square!lucide-react', '(SquareKanbanDashed|LucideSquareKanbanDashed|SquareKanbanDashedIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/kanban-square-dashed!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/kanban-square-dashed!lucide-react', '(SquareKanban|LucideSquareKanban|SquareKanbanIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/kanban-square!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/kanban-square!lucide-react', '(Edit3|LucideEdit3|Edit3Icon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen-line!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen-line!lucide-react', '(Edit|LucideEdit|EditIcon|PenBox|LucidePenBox|PenBoxIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen-square!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen-square!lucide-react', '(Edit2|LucideEdit2|Edit2Icon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/pen!lucide-react', '(Stars|LucideStars|StarsIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/sparkles!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/sparkles!lucide-react', '(TextSelection|LucideTextSelection|TextSelectionIcon)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/text-select!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/text-select!lucide-react', // General rules 'Lucide(.*)': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase memberMatches.[1] }}!lucide-react', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase memberMatches.[1] }}!lucide-react', '(.*)Icon': - 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase memberMatches.[1] }}!lucide-react', - '(.*)Icon': - 'lodash-es/{{member}}', + 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase memberMatches.[1] }}!lucide-react', '*': 'modularize-import-loader?name={{ member }}&from=default&as=default&join=../esm/icons/{{ kebabCase member }}!lucide-react', }, },