Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump deps #300

Merged
merged 5 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/create-plasmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-plasmo",
"version": "0.59.0-alpha.1",
"version": "0.59.0-alpha.2",
"description": "Create Plasmo Framework Browser Extension",
"main": "dist/index.js",
"bin": "bin/index.mjs",
Expand Down Expand Up @@ -45,6 +45,6 @@
"@plasmo/constants": "workspace:*",
"@plasmo/utils": "workspace:*",
"plasmo": "workspace:*",
"typescript": "4.8.4"
"typescript": "4.9.3"
}
}
3 changes: 2 additions & 1 deletion cli/create-plasmo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import init from "plasmo/src/commands/init"
import { argv, exit } from "process"

import { ErrorMessage } from "@plasmo/constants"
import { aLog, eLog, exitCountDown } from "@plasmo/utils"
import { aLog, eLog } from "@plasmo/utils/logging"
import { exitCountDown } from "@plasmo/utils/wait"

process.env.APP_VERSION = version

Expand Down
16 changes: 8 additions & 8 deletions cli/plasmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plasmo",
"version": "0.59.0-alpha.1",
"version": "0.59.0-alpha.2",
"description": "The Plasmo Platform CLI",
"main": "dist/index.js",
"types": "dist/type.d.ts",
Expand Down Expand Up @@ -35,10 +35,10 @@
],
"dependencies": {
"@expo/spawn-async": "1.7.0",
"@parcel/core": "2.7.0",
"@parcel/fs": "2.7.0",
"@parcel/package-manager": "2.7.0",
"@parcel/watcher": "2.0.5",
"@parcel/core": "2.8.0",
"@parcel/fs": "2.8.0",
"@parcel/package-manager": "2.8.0",
"@parcel/watcher": "2.0.7",
"@plasmohq/init": "workspace:*",
"@plasmohq/parcel-config": "workspace:*",
"archiver": "5.3.1",
Expand All @@ -50,18 +50,18 @@
"events": "3.3.0",
"fflate": "0.7.4",
"get-port": "6.1.2",
"got": "12.5.2",
"got": "12.5.3",
"inquirer": "9.1.4",
"is-path-inside": "4.0.0",
"mnemonic-id": "3.2.7",
"node-object-hash": "2.3.10",
"package-json": "8.1.0",
"process": "0.11.10",
"semver": "7.3.8",
"sharp": "0.31.1",
"sharp": "0.31.2",
"tempy": "3.0.0",
"tiny-glob": "0.2.9",
"typescript": "4.8.4"
"typescript": "4.9.3"
},
"devDependencies": {
"@plasmo/config": "workspace:*",
Expand Down
4 changes: 3 additions & 1 deletion cli/plasmo/src/commands/build.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createWriteStream } from "fs"
import { resolve } from "path"

import { getNonFlagArgvs, hasFlag, iLog, sLog } from "@plasmo/utils"
import { getNonFlagArgvs } from "@plasmo/utils/argv"
import { hasFlag } from "@plasmo/utils/flags"
import { iLog, sLog } from "@plasmo/utils/logging"

import { getBundleConfig } from "~features/extension-devtools/get-bundle-config"
import { nextNewTab } from "~features/extra/next-new-tab"
Expand Down
4 changes: 3 additions & 1 deletion cli/plasmo/src/commands/dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { aLog, eLog, getFlag, hasFlag, iLog, vLog } from "@plasmo/utils"
import { getFlag, hasFlag } from "@plasmo/utils/flags"
import { aLog, eLog, iLog, vLog } from "@plasmo/utils/logging"

import { getBundleConfig } from "~features/extension-devtools/get-bundle-config"
import { createProjectWatcher } from "~features/extension-devtools/project-watcher"
Expand Down Expand Up @@ -94,6 +95,7 @@ async function dev() {
})
})
}
process.env.__PLASMO_FRAMEWORK_INTERNAL_WATCHER_STARTED = "true"
})

const cleanup = () => {
Expand Down
4 changes: 3 additions & 1 deletion cli/plasmo/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { paramCase } from "change-case"
import { resolve } from "path"
import { cwd } from "process"

import { ensureWritableAndEmpty, hasFlag, vLog } from "@plasmo/utils"
import { hasFlag } from "@plasmo/utils/flags"
import { ensureWritableAndEmpty } from "@plasmo/utils/fs"
import { vLog } from "@plasmo/utils/logging"

import { getCommonPath } from "~features/extension-devtools/common-path"
import { getPackageManager } from "~features/helpers/package-manager"
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/commands/start.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { iLog } from "@plasmo/utils"
import { iLog } from "@plasmo/utils/logging"

async function start() {
iLog("Start the extension development...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Node, VariableDeclaration } from "typescript"
import typescript from "typescript"

import type { ManifestContentScript } from "@plasmo/constants"
import { eLog, vLog } from "@plasmo/utils"
import { eLog, vLog } from "@plasmo/utils/logging"

import { parseAst } from "./parse-ast"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { copy, ensureDir, existsSync } from "fs-extra"
import { basename, resolve } from "path"
import sharp from "sharp"

import { vLog, wLog } from "@plasmo/utils"
import { vLog, wLog } from "@plasmo/utils/logging"

import { flagMap } from "~features/helpers/flag"

Expand Down
9 changes: 6 additions & 3 deletions cli/plasmo/src/features/extension-devtools/load-env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { existsSync, statSync } from "fs"
import { readFile } from "fs/promises"
import { join } from "path"

import { eLog, iLog } from "@plasmo/utils"
import { eLog, iLog } from "@plasmo/utils/logging"

import { browser } from "~features/extension-devtools/get-bundle-config"
import { flagMap } from "~features/helpers/flag"
Expand All @@ -17,12 +17,15 @@ export type LoadedEnvFiles = Array<{
contents: string
}>

export const EMBED_ENV_PREFIX = "PLASMO_"
export const PUBLIC_ENV_PREFIX = "PLASMO_PUBLIC_"

export class PlasmoPublicEnv {
data: Env

constructor(_env: Env) {
this.data = Object.keys(_env)
.filter((k) => k.startsWith("PLASMO_PUBLIC_"))
.filter((k) => k.startsWith(PUBLIC_ENV_PREFIX))
.reduce(
(env, key) => {
env[key] = _env[key]
Expand Down Expand Up @@ -59,7 +62,7 @@ function processEnv(loadedEnvFiles: LoadedEnvFiles, dir?: string) {
if (typeof parsed[key] === "undefined") {
parsed[key] = resultData[key]

if (key.startsWith("PLASMO_")) {
if (key.startsWith(EMBED_ENV_PREFIX)) {
process.env[key] = resultData[key]
}
}
Expand Down
3 changes: 2 additions & 1 deletion cli/plasmo/src/features/extension-devtools/package-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const generatePackage = ({
packageManager: undefined as string | undefined,
scripts: {
dev: "plasmo dev",
build: "plasmo build"
build: "plasmo build",
package: "plasmo package"
},
dependencies: {
plasmo: process.env.APP_VERSION,
Expand Down
6 changes: 4 additions & 2 deletions cli/plasmo/src/features/extension-devtools/project-watcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Event, subscribe } from "@parcel/watcher"

import { PARCEL_WATCHER_BACKEND } from "@plasmo/constants"
import { assertUnreachable, hasFlag, iLog, vLog, wLog } from "@plasmo/utils"
import { PARCEL_WATCHER_BACKEND } from "@plasmo/constants/misc"
import { assertUnreachable } from "@plasmo/utils/assert"
import { hasFlag } from "@plasmo/utils/flags"
import { iLog, vLog, wLog } from "@plasmo/utils/logging"

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

Expand Down
3 changes: 2 additions & 1 deletion cli/plasmo/src/features/extra/next-new-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { copy, emptyDir, readJson, writeJson } from "fs-extra"
import { mkdir } from "fs/promises"
import { resolve } from "path"

import { fileExists, sLog, vLog } from "@plasmo/utils"
import { fileExists } from "@plasmo/utils/fs"
import { sLog, vLog } from "@plasmo/utils/logging"

import { getCommonPath } from "~features/extension-devtools/common-path"
import type { PackageJSON } from "~features/extension-devtools/package-file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync } from "fs"
import { emptyDir, ensureDir, readJson, writeJson } from "fs-extra"
import semver from "semver"

import { wLog } from "@plasmo/utils"
import { wLog } from "@plasmo/utils/logging"

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

Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/features/helpers/flag.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { paramCase } from "change-case"

import { getFlag } from "@plasmo/utils"
import { getFlag } from "@plasmo/utils/flags"

const srcPath = getFlag("--src-path") || process.env.PLASMO_SRC_PATH || "src"

Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/features/helpers/print.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cLog } from "@plasmo/utils"
import { cLog } from "@plasmo/utils/logging"

import { validCommandList } from "~commands"
import { flagHelp } from "~features/helpers/flag"
Expand Down
6 changes: 3 additions & 3 deletions cli/plasmo/src/features/helpers/traverse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { iLog } from "@plasmo/utils"
import { iLog } from "@plasmo/utils/logging"

const defaultTransformer = (target: any) =>
iLog({
Expand All @@ -16,14 +16,14 @@ export const definedTraverse = (
if (Array.isArray(target)) {
return target
.map((item) => definedTraverse(item, transformer))
.filter((i) => typeof i !== "undefined")
.filter((i) => i !== undefined)
} else if (typeof target === "object") {
const result = {} as any

for (const key in target) {
if (target.hasOwnProperty(key)) {
result[key] = definedTraverse(target[key], transformer)
if (typeof result[key] === "undefined") {
if (result[key] === undefined) {
delete result[key]
}
}
Expand Down
22 changes: 9 additions & 13 deletions cli/plasmo/src/features/manifest-factory/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import type {
ManifestContentScript,
ManifestPermission
} from "@plasmo/constants"
import { assertTruthy, vLog } from "@plasmo/utils"
import { assertTruthy } from "@plasmo/utils/assert"
import { injectEnv } from "@plasmo/utils/env"
import { vLog } from "@plasmo/utils/logging"

import {
CommonPath,
Expand Down Expand Up @@ -203,7 +205,7 @@ export abstract class BaseFactory<T extends ExtensionManifest = any> {
}

this.data.permissions = autoPermissionList.filter(
(p) => `@plasmohq/${p}` in (this.packageData?.dependencies || {})
(p) => `@plasmohq/${p}` in (this.packageData.dependencies || {})
)

await Promise.all([
Expand Down Expand Up @@ -332,7 +334,7 @@ export abstract class BaseFactory<T extends ExtensionManifest = any> {
)
}

const contentScript = this.injectEnv({
const contentScript = this.injectEnvToObj({
matches: ["<all_urls>"],
js: [scriptPath],
...(metadata?.config || {})
Expand Down Expand Up @@ -428,10 +430,7 @@ export abstract class BaseFactory<T extends ExtensionManifest = any> {
}

base.permissions = [
...new Set([
...base.permissions!,
...((overridePermissions as any) || [])
])
...new Set([...base.permissions!, ...(overridePermissions || [])])
]

if (base.permissions?.length === 0) {
Expand Down Expand Up @@ -491,7 +490,7 @@ export abstract class BaseFactory<T extends ExtensionManifest = any> {
}
}

return this.injectEnv(output)
return this.injectEnvToObj(output)
}

protected abstract resolveWAR: (
Expand Down Expand Up @@ -553,7 +552,7 @@ export abstract class BaseFactory<T extends ExtensionManifest = any> {
}
}

protected injectEnv = <T = any, O = T>(target: T): O =>
protected injectEnvToObj = <T = any, O = T>(target: T): O =>
definedTraverse(target, (value) => {
if (typeof value !== "string") {
return value
Expand All @@ -562,10 +561,7 @@ export abstract class BaseFactory<T extends ExtensionManifest = any> {
if (!!value.match(/^\$(\w+)$/)) {
return this.combinedEnv[value.substring(1)] || undefined
} else {
return value.replace(
/\$(\w+)/gm,
(envKey) => this.combinedEnv[envKey.substring(1)] || envKey
)
return injectEnv(value, this.combinedEnv)
}
})
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync } from "fs-extra"

import { vLog, wLog } from "@plasmo/utils"
import { vLog, wLog } from "@plasmo/utils/logging"

import type { PlasmoBundleConfig } from "~features/extension-devtools/get-bundle-config"

Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/features/manifest-factory/scaffolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { copy, ensureDir } from "fs-extra"
import { readFile, writeFile } from "fs/promises"
import { ParsedPath, join, relative, resolve } from "path"

import { vLog } from "@plasmo/utils"
import { vLog } from "@plasmo/utils/logging"

import { toPosix } from "~features/helpers/path"

Expand Down
3 changes: 2 additions & 1 deletion cli/plasmo/src/features/manifest-factory/ui-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { resolve } from "path"
import { cwd } from "process"
import semver from "semver"

import { assertUnreachable, fileExists } from "@plasmo/utils"
import { assertUnreachable } from "@plasmo/utils/assert"
import { fileExists } from "@plasmo/utils/fs"

import type { BaseFactory } from "./base"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import type {
ExtensionManifestV3,
ManifestPermission
} from "@plasmo/constants"
import { getFlag, vLog } from "@plasmo/utils"
import { getFlag } from "@plasmo/utils/flags"
import { vLog } from "@plasmo/utils/logging"

import type { CommonPath } from "~features/extension-devtools/common-path"
import {
Expand Down
3 changes: 2 additions & 1 deletion cli/plasmo/src/features/project-creator/get-raw-name.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createQuestId } from "mnemonic-id"

import { getNonFlagArgvs, vLog } from "@plasmo/utils"
import { getNonFlagArgvs } from "@plasmo/utils/argv"
import { vLog } from "@plasmo/utils/logging"

export const getRawName = async () => {
const [rawNameNonInteractive] = getNonFlagArgvs("init")
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/features/project-creator/git-init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import spawnAsync, { SpawnOptions } from "@expo/spawn-async"
import { existsSync } from "fs-extra"

import { iLog, vLog, wLog } from "@plasmo/utils"
import { iLog, vLog, wLog } from "@plasmo/utils/logging"

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

Expand Down
3 changes: 2 additions & 1 deletion cli/plasmo/src/features/project-creator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { userInfo } from "os"
import { resolve } from "path"
import { temporaryDirectory } from "tempy"

import { getFlag, hasFlag, iLog, vLog } from "@plasmo/utils"
import { getFlag, hasFlag } from "@plasmo/utils/flags"
import { iLog, vLog } from "@plasmo/utils/logging"

import type { CommonPath } from "~features/extension-devtools/common-path"
import { generateGitIgnore } from "~features/extension-devtools/git-ignore"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import spawnAsync from "@expo/spawn-async"

import { iLog, wLog } from "@plasmo/utils"
import { iLog, wLog } from "@plasmo/utils/logging"

import type { PackageManagerInfo } from "~features/helpers/package-manager"

Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/src/features/project-creator/print-ready.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sLog } from "@plasmo/utils"
import { sLog } from "@plasmo/utils/logging"

import type { CommonPath } from "~features/extension-devtools/common-path"
import type { PackageManagerInfo } from "~features/helpers/package-manager"
Expand Down
Loading