From f2d82a474e0940f9214ce3faabfbdd6dd0f0ccc6 Mon Sep 17 00:00:00 2001 From: L <6723574+louisgv@users.noreply.github.com> Date: Sun, 16 Apr 2023 22:21:09 -0400 Subject: [PATCH] fix: type-only import (#547) --- .github/CODE_OF_CONDUCT.md | 2 +- cli/plasmo/README.md | 2 +- cli/plasmo/i18n/README.id-ID.md | 2 +- cli/plasmo/i18n/README.ru-RU.md | 4 ++-- .../background-service-worker/bgsw-entry.ts | 2 +- .../bgsw-main-world-script.ts | 2 +- .../background-service-worker/bgsw-messaging.ts | 2 +- .../background-service-worker/update-bgsw-entry.ts | 2 +- .../features/extension-devtools/project-watcher.ts | 2 +- .../src/features/helpers/create-parcel-bundler.ts | 2 +- cli/plasmo/src/features/manifest-factory/base.ts | 13 +++++++++---- .../src/features/manifest-factory/scaffolder.ts | 4 ++-- .../src/features/manifest-factory/ui-library.ts | 2 +- .../project-creator/from-existing-manifest.ts | 4 ++-- cli/plasmo/src/features/project-creator/git-init.ts | 2 +- cli/plasmo/src/features/project-creator/index.ts | 2 +- cli/plasmo/src/index.ts | 2 +- cli/plasmo/src/type.ts | 2 +- examples | 2 +- package.json | 1 + packages/constants | 2 +- packages/prettier-plugin-sort-imports | 2 +- packages/utils | 2 +- 23 files changed, 34 insertions(+), 28 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 6f254e799..8e57e15e4 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -50,4 +50,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct/][version] [homepage]: http://contributor-covenant.org -[version]: https://www.contributor-covenant.org/version/2/1 \ No newline at end of file +[version]: https://www.contributor-covenant.org/version/2/1 diff --git a/cli/plasmo/README.md b/cli/plasmo/README.md index 56b65afa4..4c6a43766 100644 --- a/cli/plasmo/README.md +++ b/cli/plasmo/README.md @@ -26,7 +26,7 @@ English | 简体中文 | Tiếng Việt | Deutsch | French | Indonesian | Русский | Turkish

-**Production Cloud:** We've built a cloud offering for browser extensions called [Itero](https://itero.plasmo.com). Check it out if you want instant beta testing and more awesome features. +**Production Cloud:** We've built a cloud offering for browser extensions called [Itero](https://itero.plasmo.com). Check it out if you want instant beta testing and more awesome features. # Plasmo Framework diff --git a/cli/plasmo/i18n/README.id-ID.md b/cli/plasmo/i18n/README.id-ID.md index 158fd2344..d40603440 100644 --- a/cli/plasmo/i18n/README.id-ID.md +++ b/cli/plasmo/i18n/README.id-ID.md @@ -126,7 +126,7 @@ Terima kasih banyak untuk semua yang luar biasa [kontributor](https://github.com Jangan ragu untuk ikut bersenang-senang dan mengirim PR! -### Framework Plasmo +### Framework Plasmo diff --git a/cli/plasmo/i18n/README.ru-RU.md b/cli/plasmo/i18n/README.ru-RU.md index 02e200bfe..0ec54cebd 100644 --- a/cli/plasmo/i18n/README.ru-RU.md +++ b/cli/plasmo/i18n/README.ru-RU.md @@ -34,7 +34,7 @@ ![CLI Demo](https://www.plasmo.com/assets/plasmo-cli-demo.gif) -## Главные особенности +## Главные особенности - Первоклассная поддержка [React](https://reactjs.org/) + [Typescript](https://www.typescriptlang.org/) - [Декларативная настройка "manifest.json" (MV3)](https://docs.plasmo.com/framework#where-is-the-manifestjson-file) @@ -106,7 +106,7 @@ pnpm dev ... ``` -Наконец, вы также можете избежать размещения исходного кода в вашем корневом каталоге, поместив их в подкаталог `src`, [следуя этому руководству](https://docs.plasmo.com/framework/customization/src). Обратите внимание что `assets` и другие конфигурационные файлы по-прежнему должны находиться в корневом каталоге. +Наконец, вы также можете избежать размещения исходного кода в вашем корневом каталоге, поместив их в подкаталог `src`, [следуя этому руководству](https://docs.plasmo.com/framework/customization/src). Обратите внимание что `assets` и другие конфигурационные файлы по-прежнему должны находиться в корневом каталоге. ## Поддерживаемые браузеры diff --git a/cli/plasmo/src/features/background-service-worker/bgsw-entry.ts b/cli/plasmo/src/features/background-service-worker/bgsw-entry.ts index d03a333fd..872e2437c 100644 --- a/cli/plasmo/src/features/background-service-worker/bgsw-entry.ts +++ b/cli/plasmo/src/features/background-service-worker/bgsw-entry.ts @@ -4,7 +4,7 @@ import { relative, resolve } from "path" import { vLog } from "@plasmo/utils/logging" import { toPosix } from "@plasmo/utils/path" -import type { PlasmoManifest } from "~features/manifest-factory/base" +import { type PlasmoManifest } from "~features/manifest-factory/base" export const createBgswEntry = async ( { indexFilePath = "", withMessaging = false, withMainWorldScript = false }, diff --git a/cli/plasmo/src/features/background-service-worker/bgsw-main-world-script.ts b/cli/plasmo/src/features/background-service-worker/bgsw-main-world-script.ts index 8cc4b8a3a..9c4129176 100644 --- a/cli/plasmo/src/features/background-service-worker/bgsw-main-world-script.ts +++ b/cli/plasmo/src/features/background-service-worker/bgsw-main-world-script.ts @@ -5,7 +5,7 @@ import { relative, resolve } from "path" import { vLog } from "@plasmo/utils/logging" import { toPosix } from "@plasmo/utils/path" -import type { PlasmoManifest } from "~features/manifest-factory/base" +import { type PlasmoManifest } from "~features/manifest-factory/base" export const createBgswMainWorldInjector = async ( plasmoManifest: PlasmoManifest diff --git a/cli/plasmo/src/features/background-service-worker/bgsw-messaging.ts b/cli/plasmo/src/features/background-service-worker/bgsw-messaging.ts index e06a77fbb..376e0e3a5 100644 --- a/cli/plasmo/src/features/background-service-worker/bgsw-messaging.ts +++ b/cli/plasmo/src/features/background-service-worker/bgsw-messaging.ts @@ -12,7 +12,7 @@ import { outputMessagingDeclaration } from "~features/background-service-worker/bgsw-messaging-declaration" import { getMd5RevHash } from "~features/helpers/crypto" -import type { PlasmoManifest } from "~features/manifest-factory/base" +import { type PlasmoManifest } from "~features/manifest-factory/base" const state = { md5Hash: "" diff --git a/cli/plasmo/src/features/background-service-worker/update-bgsw-entry.ts b/cli/plasmo/src/features/background-service-worker/update-bgsw-entry.ts index 062965cf7..065fd4467 100644 --- a/cli/plasmo/src/features/background-service-worker/update-bgsw-entry.ts +++ b/cli/plasmo/src/features/background-service-worker/update-bgsw-entry.ts @@ -4,7 +4,7 @@ import { isAccessible } from "@plasmo/utils/fs" import { createBgswEntry } from "~features/background-service-worker/bgsw-entry" import { createBgswMainWorldInjector } from "~features/background-service-worker/bgsw-main-world-script" import { createBgswMessaging } from "~features/background-service-worker/bgsw-messaging" -import type { PlasmoManifest } from "~features/manifest-factory/base" +import { type PlasmoManifest } from "~features/manifest-factory/base" export const updateBgswEntry = async (plasmoManifest: PlasmoManifest) => { const [bgswIndexFilePath, withMessaging, withMainWorldScript] = diff --git a/cli/plasmo/src/features/extension-devtools/project-watcher.ts b/cli/plasmo/src/features/extension-devtools/project-watcher.ts index 36e718c65..87ea3fea1 100644 --- a/cli/plasmo/src/features/extension-devtools/project-watcher.ts +++ b/cli/plasmo/src/features/extension-devtools/project-watcher.ts @@ -6,7 +6,7 @@ import { hasFlag } from "@plasmo/utils/flags" import { iLog, vLog, wLog } from "@plasmo/utils/logging" import { updateBgswEntry } from "~features/background-service-worker/update-bgsw-entry" -import type { PlasmoManifest } from "~features/manifest-factory/base" +import { type PlasmoManifest } from "~features/manifest-factory/base" import { generateIcons } from "./generate-icons" import { WatchReason } from "./project-path" diff --git a/cli/plasmo/src/features/helpers/create-parcel-bundler.ts b/cli/plasmo/src/features/helpers/create-parcel-bundler.ts index 436fb24a5..8eea34f53 100644 --- a/cli/plasmo/src/features/helpers/create-parcel-bundler.ts +++ b/cli/plasmo/src/features/helpers/create-parcel-bundler.ts @@ -5,7 +5,7 @@ import { dirname, join, resolve } from "path" import { hasFlag } from "@plasmo/utils/flags" -import { Parcel, ParcelOptions } from "@plasmohq/parcel-core" +import { Parcel, type ParcelOptions } from "@plasmohq/parcel-core" import type { PlasmoManifest } from "~features/manifest-factory/base" diff --git a/cli/plasmo/src/features/manifest-factory/base.ts b/cli/plasmo/src/features/manifest-factory/base.ts index 710df4d4f..f1ec993cd 100644 --- a/cli/plasmo/src/features/manifest-factory/base.ts +++ b/cli/plasmo/src/features/manifest-factory/base.ts @@ -35,10 +35,10 @@ import { isReadable } from "@plasmo/utils/fs" import { vLog } from "@plasmo/utils/logging" import { getSubExt, toPosix } from "@plasmo/utils/path" -import { EnvConfig, loadEnvConfig } from "~features/env/env-config" +import { type EnvConfig, loadEnvConfig } from "~features/env/env-config" import { outputEnvDeclaration } from "~features/env/env-declaration" import { - CommonPath, + type CommonPath, getCommonPath } from "~features/extension-devtools/common-path" import { extractContentScriptConfig } from "~features/extension-devtools/content-script-config" @@ -46,7 +46,7 @@ import { generateIcons } from "~features/extension-devtools/generate-icons" import type { PlasmoBundleConfig } from "~features/extension-devtools/get-bundle-config" import type { PackageJSON } from "~features/extension-devtools/package-file" import { - ProjectPath, + type ProjectPath, getProjectPath } from "~features/extension-devtools/project-path" import { getTemplatePath } from "~features/extension-devtools/template-path" @@ -56,7 +56,12 @@ import { updateVersionFile } from "~features/framework-update/version-tracker" import { definedTraverse } from "~features/helpers/traverse" import { Scaffolder } from "./scaffolder" -import { UiExtMap, UiLibrary, getUiExtMap, getUiLibrary } from "./ui-library" +import { + type UiExtMap, + type UiLibrary, + getUiExtMap, + getUiLibrary +} from "./ui-library" export const iconMap = { "16": "./gen-assets/icon16.plasmo.png", diff --git a/cli/plasmo/src/features/manifest-factory/scaffolder.ts b/cli/plasmo/src/features/manifest-factory/scaffolder.ts index 2a3431d4e..8529ff14e 100644 --- a/cli/plasmo/src/features/manifest-factory/scaffolder.ts +++ b/cli/plasmo/src/features/manifest-factory/scaffolder.ts @@ -1,6 +1,6 @@ import { copy, ensureDir } from "fs-extra" import { readFile, writeFile } from "fs/promises" -import { ParsedPath, join, relative, resolve } from "path" +import { type ParsedPath, join, relative, resolve } from "path" import { find } from "@plasmo/utils/array" import { isAccessible, isFile } from "@plasmo/utils/fs" @@ -9,7 +9,7 @@ import { toPosix } from "@plasmo/utils/path" import { getMd5RevHash } from "~features/helpers/crypto" -import type { PlasmoManifest } from "./base" +import { type PlasmoManifest } from "./base" import { isSupportedUiExt } from "./ui-library" type ExtensionUIPage = "popup" | "options" | "devtools" | "newtab" diff --git a/cli/plasmo/src/features/manifest-factory/ui-library.ts b/cli/plasmo/src/features/manifest-factory/ui-library.ts index d30ca1aec..d299afb79 100644 --- a/cli/plasmo/src/features/manifest-factory/ui-library.ts +++ b/cli/plasmo/src/features/manifest-factory/ui-library.ts @@ -6,7 +6,7 @@ import semver from "semver" import { assertUnreachable } from "@plasmo/utils/assert" import { isAccessible } from "@plasmo/utils/fs" -import type { PlasmoManifest } from "./base" +import { type PlasmoManifest } from "./base" const supportedUiLibraries = ["react", "svelte", "vue", "vanilla"] as const diff --git a/cli/plasmo/src/features/project-creator/from-existing-manifest.ts b/cli/plasmo/src/features/project-creator/from-existing-manifest.ts index 833ad0d44..c76d35a61 100644 --- a/cli/plasmo/src/features/project-creator/from-existing-manifest.ts +++ b/cli/plasmo/src/features/project-creator/from-existing-manifest.ts @@ -1,4 +1,4 @@ -import { Unzipped, strFromU8, unzipSync } from "fflate" +import { type Unzipped, strFromU8, unzipSync } from "fflate" import { readJson } from "fs-extra" import { readFile } from "fs/promises" import { extname } from "path" @@ -13,7 +13,7 @@ import { vLog } from "@plasmo/utils/logging" import type { CommonPath } from "~features/extension-devtools/common-path" import { - PackageJSON, + type PackageJSON, generatePackage } from "~features/extension-devtools/package-file" import type { PackageManagerInfo } from "~features/helpers/package-manager" diff --git a/cli/plasmo/src/features/project-creator/git-init.ts b/cli/plasmo/src/features/project-creator/git-init.ts index 3a2b65e53..c6450a486 100644 --- a/cli/plasmo/src/features/project-creator/git-init.ts +++ b/cli/plasmo/src/features/project-creator/git-init.ts @@ -1,4 +1,4 @@ -import spawnAsync, { SpawnOptions } from "@expo/spawn-async" +import spawnAsync, { type SpawnOptions } from "@expo/spawn-async" import { isAccessible } from "@plasmo/utils/fs" import { iLog, vLog, wLog } from "@plasmo/utils/logging" diff --git a/cli/plasmo/src/features/project-creator/index.ts b/cli/plasmo/src/features/project-creator/index.ts index d5b0aa7b8..ba4775b27 100644 --- a/cli/plasmo/src/features/project-creator/index.ts +++ b/cli/plasmo/src/features/project-creator/index.ts @@ -14,7 +14,7 @@ import { iLog, vLog } from "@plasmo/utils/logging" import type { CommonPath } from "~features/extension-devtools/common-path" import { generateGitIgnore } from "~features/extension-devtools/git-ignore" import { - PackageJSON, + type PackageJSON, generatePackage, resolveWorkspaceToLatestSemver } from "~features/extension-devtools/package-file" diff --git a/cli/plasmo/src/index.ts b/cli/plasmo/src/index.ts index 80b187b33..1b4886311 100644 --- a/cli/plasmo/src/index.ts +++ b/cli/plasmo/src/index.ts @@ -7,7 +7,7 @@ import { verbose } from "@plasmo/utils/flags" import { eLog, vLog } from "@plasmo/utils/logging" import { exitCountDown } from "@plasmo/utils/wait" -import { ValidCommand, runMap, validCommandSet } from "~commands" +import { type ValidCommand, runMap, validCommandSet } from "~commands" import { printHeader, printHelp } from "~features/helpers/print" async function defaultMode() { diff --git a/cli/plasmo/src/type.ts b/cli/plasmo/src/type.ts index c7e1f8e0b..6c6946951 100644 --- a/cli/plasmo/src/type.ts +++ b/cli/plasmo/src/type.ts @@ -1,6 +1,6 @@ -// See https://www.plasmo.com/engineering/log/2022.04#update-2022.04.23 import type { ManifestContentScript } from "@plasmo/constants/manifest/content-script" +// See https://www.plasmo.com/engineering/log/2022.04#update-2022.04.23 export type PlasmoCSConfig = Omit, "js"> /** diff --git a/examples b/examples index de86f81d9..4810cdf23 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit de86f81d95211b02814a92e7d83d16bdf590a82a +Subproject commit 4810cdf234699c1ab40c1e5ec001583825669260 diff --git a/package.json b/package.json index 7673edbac..62c102b13 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "publish:cli": "pnpm --filter \"./cli/*\" publish", "publish:cli:lab": "pnpm --filter \"./cli/*\" publish --no-git-checks --tag lab", "publish:lab": "run-s publish:packages publish:cli:lab", + "format": "prettier --write \"**/*.{ts,tsx,md}\"", "### version script usage example": "pnpm v:cli patch", "v:packages": "pnpm --filter \"./packages/**\" --parallel -r exec pnpm version --commit-hooks false --git-tag-version false --workspaces-update", "v:parcel": "pnpm --filter \"./packages/parcel-*\" --parallel -r exec pnpm version --commit-hooks false --git-tag-version false --workspaces-update", diff --git a/packages/constants b/packages/constants index f7354e3ab..3f81df297 160000 --- a/packages/constants +++ b/packages/constants @@ -1 +1 @@ -Subproject commit f7354e3ab1d0a91fcd87a768308df4a81b3a022e +Subproject commit 3f81df297a96e478df65a1cf8f1bc6dfa3dc5233 diff --git a/packages/prettier-plugin-sort-imports b/packages/prettier-plugin-sort-imports index 2d0fc3318..b1de46a26 160000 --- a/packages/prettier-plugin-sort-imports +++ b/packages/prettier-plugin-sort-imports @@ -1 +1 @@ -Subproject commit 2d0fc3318aa404b8c8405ed321f6af14bd8f9b4d +Subproject commit b1de46a26765250e75724c7b06a93029cd46b8f5 diff --git a/packages/utils b/packages/utils index d73921cad..2838ca621 160000 --- a/packages/utils +++ b/packages/utils @@ -1 +1 @@ -Subproject commit d73921cada12485235da17348c68c023407d42fe +Subproject commit 2838ca6214117bfd93b566b4b75586f6a9bd89f7