Skip to content

Commit

Permalink
Merge branch 'PlasmoHQ:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
atgctg authored Aug 1, 2023
2 parents 47d33bf + cd7b60f commit 21b51c7
Show file tree
Hide file tree
Showing 113 changed files with 5,356 additions and 3,250 deletions.
7 changes: 4 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ requests should be made against.
To develop locally:
1. Install [pnpm](https://pnpm.io/)
1. Install [pnpm](https://pnpm.io/)
- DO NOT install pnpm a as npm's global dependency, we need pnpm to be able to link directly to your $PATH.
- Recommended installation method is with corepack or with brew (on macOS)
- If installed with brew, you might need to include the pnpm $PATH to your debugger
Expand Down Expand Up @@ -76,12 +76,13 @@ To develop locally:
```

Note: The `create-plasmo` CLI tool is not meant to be run locally.
If you have already linked it, please run
If you have already linked it, please run

```sh
pnpm -g unlink create-plasmo
```
to unlink it.

to unlink it.

## Building

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
package-manager:
[
{ name: "pnpm", exec: "pnpm dlx" },
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dist/
# misc
.DS_Store
*.pem
.idea

# debug
npm-debug.log*
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
[submodule "packages/config"]
path = packages/config
url = https://github.com/PlasmoHQ/plasmo-config.git
[submodule "packages/prettier-plugin-sort-imports"]
path = packages/prettier-plugin-sort-imports
url = https://github.com/PlasmoHQ/prettier-plugin-sort-imports.git
[submodule "api/storage"]
path = api/storage
url = [email protected]:PlasmoHQ/storage.git
Expand Down
17 changes: 0 additions & 17 deletions .prettierrc.cjs

This file was deleted.

31 changes: 31 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @type {import('prettier').Options}
*/
export default {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: false,
singleQuote: false,
trailingComma: "none",
bracketSpacing: true,
bracketSameLine: true,
plugins: ["@ianvs/prettier-plugin-sort-imports"],
importOrder: [
"<BUILTIN_MODULES>", // Node.js built-in modules
"<THIRD_PARTY_MODULES>", // Imports not matched by other special words or groups.
"", // Empty line
"^@plasmo/(.*)$",
"",
"^@plasmohq/(.*)$",
"",
"^@plasmo-static-common/(.*)$",
"",
"^~(.*)$",
"",
"^[./]",
"",
"__plasmo_import_module__",
"__plasmo_mount_content_script__"
]
}
2 changes: 1 addition & 1 deletion api/messaging/jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ const config = {
]
},
testMatch: ["**/*.test.ts"],
verbose: true,
verbose: true
}
export default config
16 changes: 8 additions & 8 deletions api/messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@
}
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@jest/types": "29.5.0",
"@jest/globals": "29.6.1",
"@jest/types": "29.6.1",
"@testing-library/react": "14.0.0",
"@types/chrome": "0.0.239",
"@types/node": "20.3.2",
"@types/react": "18.2.14",
"@types/chrome": "0.0.241",
"@types/node": "20.4.2",
"@types/react": "18.2.15",
"cross-env": "7.0.3",
"jest": "29.5.0",
"jest-environment-jsdom": "29.5.0",
"jest": "29.6.1",
"jest-environment-jsdom": "29.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "5.0.1",
"ts-jest": "29.1.0",
"ts-jest": "29.1.1",
"tsup": "7.1.0",
"typescript": "5.1.6"
},
Expand Down
2 changes: 1 addition & 1 deletion api/messaging/src/hook.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from "react"

import { type MessageName, type PlasmoMessaging, relayMessage } from "./index"
import { relayMessage, type MessageName, type PlasmoMessaging } from "./index"
import { listen as messageListen } from "./message"
import { listen as portListen } from "./port"
import { relay } from "./relay"
Expand Down
4 changes: 3 additions & 1 deletion api/messaging/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export namespace PlasmoMessaging {
}

export interface PortHook {
<TRequestBody = Record<string, any>, TResponseBody = any>(name: PortName): {
<TRequestBody = Record<string, any>, TResponseBody = any>(
name: PortName
): {
data?: TResponseBody
send: (payload: TRequestBody) => void
listen: <T = TResponseBody>(
Expand Down
14 changes: 7 additions & 7 deletions api/persistent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
"chrome-extension"
],
"devDependencies": {
"@jest/globals": "29.5.0",
"@jest/types": "29.5.0",
"@jest/globals": "29.6.1",
"@jest/types": "29.6.1",
"@plasmo/config": "workspace:*",
"@types/chrome": "0.0.239",
"@types/node": "20.3.2",
"@types/chrome": "0.0.241",
"@types/node": "20.4.2",
"cross-env": "7.0.3",
"jest": "29.5.0",
"jest-environment-jsdom": "29.5.0",
"ts-jest": "29.1.0",
"jest": "29.6.1",
"jest-environment-jsdom": "29.6.1",
"ts-jest": "29.1.1",
"tsup": "7.1.0",
"typescript": "5.1.6"
}
Expand Down
16 changes: 8 additions & 8 deletions api/selector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@
}
},
"devDependencies": {
"@jest/globals": "29.5.0",
"@jest/types": "29.5.0",
"@jest/globals": "29.6.1",
"@jest/types": "29.6.1",
"@testing-library/react": "14.0.0",
"@types/chrome": "0.0.239",
"@types/node": "20.3.2",
"@types/react": "18.2.14",
"@types/chrome": "0.0.241",
"@types/node": "20.4.2",
"@types/react": "18.2.15",
"cross-env": "7.0.3",
"jest": "29.5.0",
"jest-environment-jsdom": "29.5.0",
"jest": "29.6.1",
"jest-environment-jsdom": "29.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "5.0.1",
"ts-jest": "29.1.0",
"ts-jest": "29.1.1",
"tsup": "7.1.0",
"typescript": "5.1.6"
}
Expand Down
2 changes: 1 addition & 1 deletion api/storage
Submodule storage updated 4 files
+0 −17 .prettierrc.cjs
+10 −11 package.json
+29 −5 src/index.ts
+4 −1 src/utils.ts
1 change: 1 addition & 0 deletions cli/create-plasmo/bin/index.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env node

import "../dist/index.js"
2 changes: 1 addition & 1 deletion cli/create-plasmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-plasmo",
"version": "0.77.5",
"version": "0.82.0",
"description": "Create Plasmo Framework Browser Extension",
"main": "dist/index.js",
"bin": "bin/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion cli/create-plasmo/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { argv, exit } from "process"
import { version } from "plasmo/package.json"
import init from "plasmo/src/commands/init"
import { argv, exit } from "process"

import { ErrorMessage } from "@plasmo/constants/error"
import { aLog, eLog } from "@plasmo/utils/logging"
Expand Down
1 change: 1 addition & 0 deletions cli/plasmo/bin/index.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env node

import "../dist/index.js"
2 changes: 1 addition & 1 deletion cli/plasmo/i18n/README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pnpm dev

変更したい部分によって、以下のファイルを編集してください。

- ポップアップ → `popup.tsx`
- ポップアップ → `popup.tsx`
- 設定ページ → `options.tsx`
- コンテンツスクリプト → `content.ts`
- バックグランドサービスワーカー → `background.ts`
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/index.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { argv, exit } from "process"
import { build, context } from "esbuild"
import fse from "fs-extra"
import { argv, exit } from "process"

const watch = argv.includes("-w")

Expand Down
20 changes: 10 additions & 10 deletions cli/plasmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plasmo",
"version": "0.77.5",
"version": "0.82.0",
"description": "The Plasmo Framework CLI",
"publishConfig": {
"types": "dist/type.d.ts"
Expand All @@ -18,7 +18,7 @@
"scripts": {
"dev": "node index.mjs -w",
"build": "node index.mjs",
"type": "tsup src/type.ts --dts-only --dts-resolve",
"type": "tsup src/type.ts --format esm --dts-only --dts-resolve",
"prepublishOnly": "run-p type build",
"lint": "run-p lint:*",
"lint:type": "tsc --noemit",
Expand All @@ -41,35 +41,35 @@
"@parcel/core": "2.9.3",
"@parcel/fs": "2.9.3",
"@parcel/package-manager": "2.9.3",
"@parcel/watcher": "2.1.0",
"@parcel/watcher": "2.2.0",
"@plasmohq/init": "workspace:*",
"@plasmohq/parcel-config": "workspace:*",
"@plasmohq/parcel-core": "workspace:*",
"archiver": "5.3.1",
"buffer": "6.0.3",
"chalk": "5.2.0",
"chalk": "5.3.0",
"change-case": "4.1.2",
"dotenv": "16.3.1",
"dotenv-expand": "10.0.0",
"events": "3.3.0",
"fast-glob": "3.2.12",
"fast-glob": "3.3.0",
"fflate": "0.8.0",
"get-port": "7.0.0",
"got": "13.0.0",
"ignore": "5.2.4",
"inquirer": "9.2.7",
"inquirer": "9.2.8",
"is-path-inside": "4.0.0",
"json5": "2.2.3",
"mnemonic-id": "3.2.7",
"node-object-hash": "3.0.0",
"package-json": "8.1.1",
"process": "0.11.10",
"semver": "7.5.3",
"sharp": "0.32.1",
"tempy": "3.0.0",
"semver": "7.5.4",
"sharp": "0.32.3",
"tempy": "3.1.0",
"typescript": "5.1.6"
},
"devDependencies": {
"vue": "3.3.4",
"@plasmo/config": "workspace:*",
"@plasmo/constants": "workspace:*",
"@plasmo/framework-shared": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { paramCase } from "change-case"
import { resolve } from "path"
import { cwd } from "process"
import { paramCase } from "change-case"

import { hasFlag } from "@plasmo/utils/flags"
import { ensureWritableAndEmpty } from "@plasmo/utils/fs"
Expand Down
3 changes: 2 additions & 1 deletion cli/plasmo/src/commands/package.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { hasFlag } from "@plasmo/utils/flags"
import { iLog } from "@plasmo/utils/logging"

import { getBundleConfig } from "~features/extension-devtools/get-bundle-config"
Expand All @@ -18,7 +19,7 @@ async function packageCmd() {

const plasmoManifest = await createManifest(bundleConfig)

await zipBundle(plasmoManifest.commonPath)
await zipBundle(plasmoManifest.commonPath, hasFlag("--with-source-maps"))
}

export default packageCmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ensureDir, outputFile } from "fs-extra"
import { relative, resolve } from "path"
import { ensureDir, outputFile } from "fs-extra"

import { vLog } from "@plasmo/utils/logging"
import { toPosix } from "@plasmo/utils/path"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { relative, resolve } from "path"
import { camelCase } from "change-case"
import { outputFile } from "fs-extra"
import { relative, resolve } from "path"

import { vLog } from "@plasmo/utils/logging"
import { toPosix } from "@plasmo/utils/path"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { outputFile } from "fs-extra"
import { resolve } from "path"
import { outputFile } from "fs-extra"

import type { CommonPath } from "~features/extension-devtools/common-path"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join, resolve } from "path"
import { camelCase } from "change-case"
import glob from "fast-glob"
import { outputFile } from "fs-extra"
import { join, resolve } from "path"

import { isWriteable } from "@plasmo/utils/fs"
import { vLog, wLog } from "@plasmo/utils/logging"
Expand Down
4 changes: 2 additions & 2 deletions cli/plasmo/src/features/env/env-config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Forked from https://github.com/vercel/next.js/blob/canary/packages/next-env/index.ts
import { readFile } from "fs/promises"
import { resolve } from "path"
import { constantCase } from "change-case"
import dotenv from "dotenv"
import { expand as dotenvExpand } from "dotenv-expand"
import { readFile } from "fs/promises"
import { resolve } from "path"

import { isFile, isReadable } from "@plasmo/utils/fs"
import { eLog, iLog, vLog } from "@plasmo/utils/logging"
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/features/env/env-declaration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { outputFile } from "fs-extra"
import { resolve } from "path"
import { outputFile } from "fs-extra"

import type { PlasmoManifest } from "~features/manifest-factory/base"

Expand Down
Loading

0 comments on commit 21b51c7

Please sign in to comment.