Skip to content

Commit e304af7

Browse files
committed
refactor: reorganize type imports and remove unused type files
1 parent f4fabed commit e304af7

File tree

12 files changed

+22
-20
lines changed

12 files changed

+22
-20
lines changed

codegen/codegen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { RequestPayload, ResponsePayload, CodeBlock } from '@/codegen/types'
2-
import type { Plugin } from '@/shared/types'
1+
import type { RequestPayload, ResponsePayload, CodeBlock } from '@/types/codegen'
2+
import type { Plugin } from '@/types/plugin'
33

44
import { serializeComponent } from '@/utils/component'
55
import { serializeCSS } from '@/utils/css'

components/sections/CodeSection.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import type { CodeBlock } from '@/codegen/types'
2+
import type { CodeBlock } from '@/types/codegen'
33
44
import Badge from '@/components/Badge.vue'
55
import Code from '@/components/Code.vue'

entrypoints/background.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RULES_URL } from '@/rewrite/shared'
22
import rules from '@/public/rules/figma.json'
3-
import type { Rules } from './types'
3+
import type { Rules } from '../types/rewrite'
44

55
const SYNC_ALARM = 'sync-rules'
66
const SYNC_INTERVAL_MINUTES = 10

entrypoints/rewrite.content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import rules from '@/public/rules/figma.json'
22
import { applyGroups, RULES_URL, REWRITE_RULE_ID } from '@/rewrite/shared'
33
import { GROUPS } from '@/rewrite/config'
4-
import type { BlobHandle, CacheEntry, Rules } from './types'
4+
import type { BlobHandle, CacheEntry, Rules } from '../types/rewrite'
55

66
export default defineContentScript({
77
matches: [

rewrite/config.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
export type Replacement = {
2-
pattern: string | RegExp
3-
replacer: string | ((...args: any[]) => string)
4-
}
5-
6-
export type Group = {
7-
markers?: string[]
8-
replacements: Replacement[]
9-
}
1+
import type { Group } from '@/types/rewrite'
102

113
export const GROUPS: Group[] = [
124
{

rewrite/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Group } from './config'
1+
import type { Group } from '@/types/rewrite'
22

33
export const RULES_URL = 'https://ecomfe.github.io/tempad-dev/figma.json'
44
export const REWRITE_RULE_ID = 2

codegen/types.ts renamed to types/codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { DesignComponent, SupportedLang } from '@/shared/types'
1+
import type { DesignComponent, SupportedLang } from '@/types/plugin'
22

33
export interface SerializeOptions {
44
useRem: boolean
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
export type Replacement = {
2+
pattern: string | RegExp
3+
replacer: string | ((...args: any[]) => string)
4+
}
5+
6+
export type Group = {
7+
markers?: string[]
8+
replacements: Replacement[]
9+
}
10+
111
export interface CacheEntry {
212
url: string
313
ref: number

utils/codegen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { RequestPayload, ResponsePayload, SerializeOptions } from '@/codegen/types'
2-
import type { DesignComponent } from '@/shared/types'
1+
import type { RequestPayload, ResponsePayload, SerializeOptions } from '@/types/codegen'
2+
import type { DesignComponent } from '@/types/plugin'
33

44
import Codegen from '@/codegen/codegen?worker&inline'
55
import { createWorkerRequester } from '@/codegen/worker'

0 commit comments

Comments
 (0)