@any-listen/extension-kit 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { argv } from 'node:process'\nimport { parseArgs } from 'node:util'\n\nconst { values } = parseArgs({\n args: argv.slice(2),\n options: {\n build: {\n type: 'boolean',\n },\n publish: {\n type: 'boolean',\n },\n },\n})\n\nif (values.build) {\n void import('./build')\n} else if (values.publish) {\n void import('./publish')\n} else {\n console.log('Please specify a command: build or publish')\n}\n"],"mappings":";;;;AAKA,IAAM,EAAE,WAAW,UAAU;CAC3B,MAAM,KAAK,MAAM,EAAE;CACnB,SAAS;EACP,OAAO,EACL,MAAM,WACP;EACD,SAAS,EACP,MAAM,WACP;EACF;CACF,CAAC;AAEF,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"bin.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { argv } from 'node:process'\nimport { parseArgs } from 'node:util'\n\nconst { values } = parseArgs({\n args: argv.slice(2),\n options: {\n build: {\n type: 'boolean',\n },\n publish: {\n type: 'boolean',\n },\n },\n})\n\nif (values.build) {\n void import('./build')\n} else if (values.publish) {\n void import('./publish')\n} else {\n console.log('Please specify a command: build or publish')\n}\n"],"mappings":";;;;AAKA,IAAM,EAAE,WAAW,UAAU;CAC3B,MAAM,KAAK,MAAM,EAAE;CACnB,SAAS;EACP,OAAO,EACL,MAAM,WACP;EACD,SAAS,EACP,MAAM,WACP;EACF;CACF,CAAC;AAEF,IAAI,OAAO,OACT,OAAY;KACP,IAAI,OAAO,SAChB,OAAY;KAEZ,QAAQ,IAAI,6CAA6C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-cwRtaFpY.js","names":[],"sources":["../src/cpResources.ts","../src/mainifest.ts","../src/pack.ts","../src/vite.config.ts","../src/build.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { state } from './state'\n\nexport const cpResources = async () => {\n const sourcePath = state.resourcesDir\n const targetPath = path.join(state.distDir, 'resources')\n const sourceI18nPath = state.i18nDir\n const targetI18nPath = path.join(state.distDir, 'i18n')\n\n await Promise.all([\n fs.promises.cp(sourcePath, targetPath, { recursive: true }),\n fs.promises.cp(sourceI18nPath, targetI18nPath, { recursive: true }),\n ])\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\nimport type { ExtensionConfig } from './types/build'\n\nexport const createMainifest = async (config: ExtensionConfig) => {\n const mainifest = {\n id: config.id,\n name: config.name,\n description: config.description,\n icon: config.icon,\n version: config.version,\n target_engine: config.target_engine,\n author: config.author,\n homepage: config.homepage,\n license: config.license,\n categories: config.categories,\n tags: config.tags,\n grant: config.grant,\n contributes: config.contributes,\n main: EXTENSION.entryFileName,\n }\n\n await fs.promises.writeFile(path.join(state.distDir, EXTENSION.mainifestName), JSON.stringify(mainifest, null, 2), 'utf8')\n}\n","import crypto from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\nimport type { ExtensionConfig } from './types/build'\nimport { buildPackageName } from './utils'\n\nconst buildPublicKey = (publicKey: string) => {\n if (!publicKey.includes('-----BEGIN PUBLIC KEY-----')) {\n return `-----BEGIN PUBLIC KEY-----\\n${publicKey}\\n-----END PUBLIC KEY-----`\n }\n return publicKey\n}\n\nconst signData = (data: Buffer, privateKey: string) => {\n const sign = crypto.createSign('SHA256')\n sign.update(data)\n sign.end()\n const signature = sign.sign(privateKey, 'hex')\n return signature\n}\nconst verifySignature = (data: Buffer, publicKey: string, signature: string) => {\n const verify = crypto.createVerify('SHA256')\n verify.update(data)\n verify.end()\n const isValid = verify.verify(publicKey, signature, 'hex')\n return isValid\n}\n\nconst packFile = async ({ gzip, cwd, files, dist }: { gzip: boolean; cwd: string; files: string[]; dist: string }) => {\n const { c } = await import('tar')\n return new Promise<void>((resolve, reject) => {\n c(\n {\n gzip,\n cwd,\n },\n files\n )\n .pipe(fs.createWriteStream(dist))\n .on('finish', () => {\n resolve()\n })\n .on('error', reject)\n })\n}\n\nexport const pack = async (config: ExtensionConfig) => {\n let privateKey = process.env.PRI_KEY?.trim()\n let publicKey = process.env.PUB_KEY?.trim()\n if (!privateKey || !publicKey) throw new Error('Missing private key or public key')\n if (!privateKey.includes('-----BEGIN PRIVATE KEY-----')) {\n privateKey = `-----BEGIN PRIVATE KEY-----\\n${privateKey}\\n-----END PRIVATE KEY-----`\n }\n\n const unpackedDir = path.join(state.outputDir, 'unpacked')\n await fs.promises.rm(unpackedDir, { recursive: true }).catch(() => {})\n await fs.promises.mkdir(unpackedDir, { recursive: true }).catch(() => {})\n const extBundleFilePath = path.join(unpackedDir, EXTENSION.extBundleFileName)\n await packFile({\n gzip: true,\n cwd: state.distDir,\n files: [EXTENSION.entryFileName, EXTENSION.mainifestName, 'resources', 'i18n'],\n dist: extBundleFilePath,\n })\n const buf = await fs.promises.readFile(extBundleFilePath)\n const signature = signData(buf, privateKey)\n if (!verifySignature(buf, buildPublicKey(publicKey), signature)) {\n throw new Error('Signature is valid, please check your public key')\n }\n await fs.promises.writeFile(path.join(unpackedDir, EXTENSION.signFileName), `${signature}\\n${publicKey}`)\n await packFile({\n gzip: true,\n cwd: unpackedDir,\n files: [EXTENSION.extBundleFileName, EXTENSION.signFileName],\n dist: path.join(state.outputDir, buildPackageName(config)),\n })\n}\n","import { defineConfig } from 'vite'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\n\nconst createBuildConfig = (name: string, filePath: string) => {\n return defineConfig({\n base: './',\n mode: process.env.NODE_ENV,\n publicDir: false,\n resolve: {\n alias: {\n '@': state.srcDir,\n },\n },\n build: {\n target: 'esnext',\n emptyOutDir: true,\n minify: false,\n outDir: state.distDir,\n rolldownOptions: {\n external: ['any-listen'],\n input: {\n [name]: filePath,\n },\n output: {\n entryFileNames: '[name]',\n format: 'iife',\n },\n },\n },\n })\n}\n\nexport default (isIsolateMode?: boolean) => {\n const inputs = isIsolateMode\n ? {\n [EXTENSION.entryFileName]: state.mainEntry,\n 'resources/isolate-preload.js': state.isolatePreloadEntry,\n }\n : {\n [EXTENSION.entryFileName]: state.mainEntry,\n }\n return Object.entries(inputs).map(([name, filePath]) => createBuildConfig(name, filePath))\n}\n","import { cpResources } from './cpResources'\nimport { createMainifest } from './mainifest'\nimport { pack } from './pack'\nimport { state } from './state'\nimport { build, getConfig, loadEnvFile } from './utils'\nimport createConfigs from './vite.config'\n\nconst run = async () => {\n await loadEnvFile()\n const config = await getConfig()\n const appConfigs = createConfigs(state.isIsolateMode)\n await Promise.all(appConfigs.map(async (appConfig) => build(appConfig)))\n await Promise.all([cpResources(), createMainifest(config)])\n await pack(config)\n}\n\nvoid run()\n"],"mappings":";;;;;;AAKA,IAAa,cAAc,YAAY;CACrC,MAAM,aAAa,MAAM;CACzB,MAAM,aAAa,KAAK,KAAK,MAAM,SAAS,YAAY;CACxD,MAAM,iBAAiB,MAAM;CAC7B,MAAM,iBAAiB,KAAK,KAAK,MAAM,SAAS,OAAO;
|
|
1
|
+
{"version":3,"file":"build-cwRtaFpY.js","names":[],"sources":["../src/cpResources.ts","../src/mainifest.ts","../src/pack.ts","../src/vite.config.ts","../src/build.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { state } from './state'\n\nexport const cpResources = async () => {\n const sourcePath = state.resourcesDir\n const targetPath = path.join(state.distDir, 'resources')\n const sourceI18nPath = state.i18nDir\n const targetI18nPath = path.join(state.distDir, 'i18n')\n\n await Promise.all([\n fs.promises.cp(sourcePath, targetPath, { recursive: true }),\n fs.promises.cp(sourceI18nPath, targetI18nPath, { recursive: true }),\n ])\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\nimport type { ExtensionConfig } from './types/build'\n\nexport const createMainifest = async (config: ExtensionConfig) => {\n const mainifest = {\n id: config.id,\n name: config.name,\n description: config.description,\n icon: config.icon,\n version: config.version,\n target_engine: config.target_engine,\n author: config.author,\n homepage: config.homepage,\n license: config.license,\n categories: config.categories,\n tags: config.tags,\n grant: config.grant,\n contributes: config.contributes,\n main: EXTENSION.entryFileName,\n }\n\n await fs.promises.writeFile(path.join(state.distDir, EXTENSION.mainifestName), JSON.stringify(mainifest, null, 2), 'utf8')\n}\n","import crypto from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\nimport type { ExtensionConfig } from './types/build'\nimport { buildPackageName } from './utils'\n\nconst buildPublicKey = (publicKey: string) => {\n if (!publicKey.includes('-----BEGIN PUBLIC KEY-----')) {\n return `-----BEGIN PUBLIC KEY-----\\n${publicKey}\\n-----END PUBLIC KEY-----`\n }\n return publicKey\n}\n\nconst signData = (data: Buffer, privateKey: string) => {\n const sign = crypto.createSign('SHA256')\n sign.update(data)\n sign.end()\n const signature = sign.sign(privateKey, 'hex')\n return signature\n}\nconst verifySignature = (data: Buffer, publicKey: string, signature: string) => {\n const verify = crypto.createVerify('SHA256')\n verify.update(data)\n verify.end()\n const isValid = verify.verify(publicKey, signature, 'hex')\n return isValid\n}\n\nconst packFile = async ({ gzip, cwd, files, dist }: { gzip: boolean; cwd: string; files: string[]; dist: string }) => {\n const { c } = await import('tar')\n return new Promise<void>((resolve, reject) => {\n c(\n {\n gzip,\n cwd,\n },\n files\n )\n .pipe(fs.createWriteStream(dist))\n .on('finish', () => {\n resolve()\n })\n .on('error', reject)\n })\n}\n\nexport const pack = async (config: ExtensionConfig) => {\n let privateKey = process.env.PRI_KEY?.trim()\n let publicKey = process.env.PUB_KEY?.trim()\n if (!privateKey || !publicKey) throw new Error('Missing private key or public key')\n if (!privateKey.includes('-----BEGIN PRIVATE KEY-----')) {\n privateKey = `-----BEGIN PRIVATE KEY-----\\n${privateKey}\\n-----END PRIVATE KEY-----`\n }\n\n const unpackedDir = path.join(state.outputDir, 'unpacked')\n await fs.promises.rm(unpackedDir, { recursive: true }).catch(() => {})\n await fs.promises.mkdir(unpackedDir, { recursive: true }).catch(() => {})\n const extBundleFilePath = path.join(unpackedDir, EXTENSION.extBundleFileName)\n await packFile({\n gzip: true,\n cwd: state.distDir,\n files: [EXTENSION.entryFileName, EXTENSION.mainifestName, 'resources', 'i18n'],\n dist: extBundleFilePath,\n })\n const buf = await fs.promises.readFile(extBundleFilePath)\n const signature = signData(buf, privateKey)\n if (!verifySignature(buf, buildPublicKey(publicKey), signature)) {\n throw new Error('Signature is valid, please check your public key')\n }\n await fs.promises.writeFile(path.join(unpackedDir, EXTENSION.signFileName), `${signature}\\n${publicKey}`)\n await packFile({\n gzip: true,\n cwd: unpackedDir,\n files: [EXTENSION.extBundleFileName, EXTENSION.signFileName],\n dist: path.join(state.outputDir, buildPackageName(config)),\n })\n}\n","import { defineConfig } from 'vite'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\n\nconst createBuildConfig = (name: string, filePath: string) => {\n return defineConfig({\n base: './',\n mode: process.env.NODE_ENV,\n publicDir: false,\n resolve: {\n alias: {\n '@': state.srcDir,\n },\n },\n build: {\n target: 'esnext',\n emptyOutDir: true,\n minify: false,\n outDir: state.distDir,\n rolldownOptions: {\n external: ['any-listen'],\n input: {\n [name]: filePath,\n },\n output: {\n entryFileNames: '[name]',\n format: 'iife',\n },\n },\n },\n })\n}\n\nexport default (isIsolateMode?: boolean) => {\n const inputs = isIsolateMode\n ? {\n [EXTENSION.entryFileName]: state.mainEntry,\n 'resources/isolate-preload.js': state.isolatePreloadEntry,\n }\n : {\n [EXTENSION.entryFileName]: state.mainEntry,\n }\n return Object.entries(inputs).map(([name, filePath]) => createBuildConfig(name, filePath))\n}\n","import { cpResources } from './cpResources'\nimport { createMainifest } from './mainifest'\nimport { pack } from './pack'\nimport { state } from './state'\nimport { build, getConfig, loadEnvFile } from './utils'\nimport createConfigs from './vite.config'\n\nconst run = async () => {\n await loadEnvFile()\n const config = await getConfig()\n const appConfigs = createConfigs(state.isIsolateMode)\n await Promise.all(appConfigs.map(async (appConfig) => build(appConfig)))\n await Promise.all([cpResources(), createMainifest(config)])\n await pack(config)\n}\n\nvoid run()\n"],"mappings":";;;;;;AAKA,IAAa,cAAc,YAAY;CACrC,MAAM,aAAa,MAAM;CACzB,MAAM,aAAa,KAAK,KAAK,MAAM,SAAS,YAAY;CACxD,MAAM,iBAAiB,MAAM;CAC7B,MAAM,iBAAiB,KAAK,KAAK,MAAM,SAAS,OAAO;CAEvD,MAAM,QAAQ,IAAI,CAChB,GAAG,SAAS,GAAG,YAAY,YAAY,EAAE,WAAW,MAAM,CAAC,EAC3D,GAAG,SAAS,GAAG,gBAAgB,gBAAgB,EAAE,WAAW,MAAM,CAAC,CACpE,CAAC;;;;ACPJ,IAAa,kBAAkB,OAAO,WAA4B;CAChE,MAAM,YAAY;EAChB,IAAI,OAAO;EACX,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,MAAM,OAAO;EACb,SAAS,OAAO;EAChB,eAAe,OAAO;EACtB,QAAQ,OAAO;EACf,UAAU,OAAO;EACjB,SAAS,OAAO;EAChB,YAAY,OAAO;EACnB,MAAM,OAAO;EACb,OAAO,OAAO;EACd,aAAa,OAAO;EACpB,MAAM,UAAU;EACjB;CAED,MAAM,GAAG,SAAS,UAAU,KAAK,KAAK,MAAM,SAAS,UAAU,cAAc,EAAE,KAAK,UAAU,WAAW,MAAM,EAAE,EAAE,OAAO;;;;AChB5H,IAAM,kBAAkB,cAAsB;CAC5C,IAAI,CAAC,UAAU,SAAS,6BAA6B,EACnD,OAAO,+BAA+B,UAAU;CAElD,OAAO;;AAGT,IAAM,YAAY,MAAc,eAAuB;CACrD,MAAM,OAAO,OAAO,WAAW,SAAS;CACxC,KAAK,OAAO,KAAK;CACjB,KAAK,KAAK;CAEV,O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3D,MAAM,KAAK,OAAO;;AAGf,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-WfB8QiEk.js","names":[],"sources":["../src/publish.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport type { VersionInfo } from './types/build'\nimport { buildPackageName, getConfig, ROOT_DIR } from './utils'\n\nexport const run = async () => {\n const config = await getConfig()\n const filePath = path.join(ROOT_DIR, 'publish/version.json')\n let versionInfo = await fs.promises\n .readFile(filePath, 'utf-8')\n .then((d) => JSON.parse(d) as VersionInfo)\n .catch(() => null)\n if (versionInfo) {\n if (versionInfo.version === config.version) {\n console.warn(`Version (v${config.version}) already published`)\n process.exit(1)\n }\n versionInfo.history ||= []\n versionInfo.history.push({\n version: versionInfo.version,\n download_url: versionInfo.download_url,\n log: versionInfo.log,\n date: versionInfo.date,\n })\n } else {\n versionInfo = { version: '', download_url: '', log: '', date: new Date().toISOString(), history: [] }\n }\n versionInfo.version = config.version\n if (config.download_url_template) {\n versionInfo.download_url = `${config.download_url_template.replaceAll('{version}', config.version)}/${buildPackageName(config)}`\n }\n versionInfo.log = await fs.promises\n .readFile(path.join(ROOT_DIR, 'publish/changeLog.md'), 'utf-8')\n .then((d) => d.toString().trim())\n .catch(() => '')\n versionInfo.date = new Date().toISOString()\n\n await fs.promises.rm(filePath, { recursive: true, force: true })\n await fs.promises.writeFile(filePath, JSON.stringify(versionInfo))\n}\n\nvoid run()\n"],"mappings":";;;;AAMA,IAAa,MAAM,YAAY;CAC7B,MAAM,SAAS,MAAM,WAAW;CAChC,MAAM,WAAW,KAAK,KAAK,UAAU,uBAAuB;CAC5D,IAAI,cAAc,MAAM,GAAG,SACxB,SAAS,UAAU,QAAQ,CAC3B,MAAM,MAAM,KAAK,MAAM,EAAE,CAAgB,CACzC,YAAY,KAAK;
|
|
1
|
+
{"version":3,"file":"publish-WfB8QiEk.js","names":[],"sources":["../src/publish.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport type { VersionInfo } from './types/build'\nimport { buildPackageName, getConfig, ROOT_DIR } from './utils'\n\nexport const run = async () => {\n const config = await getConfig()\n const filePath = path.join(ROOT_DIR, 'publish/version.json')\n let versionInfo = await fs.promises\n .readFile(filePath, 'utf-8')\n .then((d) => JSON.parse(d) as VersionInfo)\n .catch(() => null)\n if (versionInfo) {\n if (versionInfo.version === config.version) {\n console.warn(`Version (v${config.version}) already published`)\n process.exit(1)\n }\n versionInfo.history ||= []\n versionInfo.history.push({\n version: versionInfo.version,\n download_url: versionInfo.download_url,\n log: versionInfo.log,\n date: versionInfo.date,\n })\n } else {\n versionInfo = { version: '', download_url: '', log: '', date: new Date().toISOString(), history: [] }\n }\n versionInfo.version = config.version\n if (config.download_url_template) {\n versionInfo.download_url = `${config.download_url_template.replaceAll('{version}', config.version)}/${buildPackageName(config)}`\n }\n versionInfo.log = await fs.promises\n .readFile(path.join(ROOT_DIR, 'publish/changeLog.md'), 'utf-8')\n .then((d) => d.toString().trim())\n .catch(() => '')\n versionInfo.date = new Date().toISOString()\n\n await fs.promises.rm(filePath, { recursive: true, force: true })\n await fs.promises.writeFile(filePath, JSON.stringify(versionInfo))\n}\n\nvoid run()\n"],"mappings":";;;;AAMA,IAAa,MAAM,YAAY;CAC7B,MAAM,SAAS,MAAM,WAAW;CAChC,MAAM,WAAW,KAAK,KAAK,UAAU,uBAAuB;CAC5D,IAAI,cAAc,MAAM,GAAG,SACxB,SAAS,UAAU,QAAQ,CAC3B,MAAM,MAAM,KAAK,MAAM,EAAE,CAAgB,CACzC,YAAY,KAAK;CACpB,IAAI,aAAa;EACf,IAAI,YAAY,YAAY,OAAO,SAAS;GAC1C,QAAQ,KAAK,aAAa,OAAO,QAAQ,qBAAqB;GAC9D,QAAQ,KAAK,EAAE;;EAEjB,YAAY,YAAY,EAAE;EAC1B,YAAY,QAAQ,KAAK;GACvB,SAAS,YAAY;GACrB,cAAc,YAAY;GAC1B,KAAK,YAAY;GACjB,MAAM,YAAY;GACnB,CAAC;QAEF,cAAc;EAAE,SAAS;EAAI,cAAc;EAAI,KAAK;EAAI,uBAAM,IAAI,MAAM,EAAC,aAAa;EAAE,SAAS,EAAE;EAAE;CAEvG,YAAY,UAAU,OAAO;CAC7B,IAAI,OAAO,uBACT,YAAY,eAAe,GAAG,OAAO,sBAAsB,WAAW,aAAa,OAAO,QAAQ,CAAC,GAAG,iBAAiB,OAAO;CAEhI,YAAY,MAAM,MAAM,GAAG,SACxB,SAAS,KAAK,KAAK,UAAU,uBAAuB,EAAE,QAAQ,CAC9D,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAChC,YAAY,GAAG;CAClB,YAAY,wBAAO,IAAI,MAAM,EAAC,aAAa;CAE3C,MAAM,GAAG,SAAS,GAAG,UAAU;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;CAChE,MAAM,GAAG,SAAS,UAAU,UAAU,KAAK,UAAU,YAAY,CAAC;;AAG/D,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-BN85b34y.js","names":[],"sources":["../src/state.ts","../src/constants.ts","../src/utils.ts"],"sourcesContent":["export const state = {\n srcDir: '',\n distDir: '',\n outputDir: '',\n i18nDir: '',\n resourcesDir: '',\n isIsolateMode: false,\n mainEntry: '',\n isolatePreloadEntry: '',\n}\n","export const EXTENSION = {\n pkgExtName: 'alix',\n mainifestName: 'manifest.json',\n signFileName: 'sig',\n extBundleFileName: 'ext.tgz',\n entryFileName: 'main.js',\n versionInfoName: 'version.json',\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { build as viteBuild, type UserConfig } from 'vite'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\nimport type { ExtensionConfig } from './types/build'\n\nexport const ROOT_DIR = path.join(import.meta.dirname.split('node_modules')[0])\n\nconst buildPath = (subPath: string) => {\n if (path.isAbsolute(subPath)) return subPath\n return path.join(ROOT_DIR, subPath)\n}\n\nexport const getConfig = async () => {\n const configPath = path.join(ROOT_DIR, 'config.ts')\n await fs.access(configPath, fs.constants.F_OK)\n const config = ((await import(`file://${configPath}`)) as { default: ExtensionConfig }).default\n\n state.srcDir = buildPath(config.buildConfig?.srcDir || 'src')\n state.distDir = buildPath(config.buildConfig?.distDir || 'dist')\n state.outputDir = buildPath(config.buildConfig?.outputDir || 'build')\n state.i18nDir = buildPath(config.buildConfig?.i18nDir || 'i18n')\n state.resourcesDir = buildPath(config.buildConfig?.resourcesDir || 'resources')\n state.isIsolateMode = config.buildConfig?.isIsolateMode || false\n if (state.isIsolateMode) {\n state.mainEntry = buildPath(config.buildConfig?.mainEntry || path.join(state.srcDir, 'main/index.ts'))\n state.isolatePreloadEntry = buildPath(\n config.buildConfig?.isolatePreloadEntry || path.join(state.srcDir, 'isolate-preload/index.ts')\n )\n } else {\n state.mainEntry = buildPath(config.buildConfig?.mainEntry || path.join(state.srcDir, 'index.ts'))\n }\n\n return config\n}\n\nexport const loadEnvFile = async () => {\n const envPath = path.join(ROOT_DIR, '.env')\n let envContent: string\n try {\n await fs.access(envPath, fs.constants.F_OK)\n envContent = (await fs.readFile(envPath, 'utf-8')).trim()\n } catch {\n return\n }\n if (!envContent) return\n const lines = envContent.split('\\n')\n for (const line of lines) {\n let [key, ...rest] = line.split('=')\n key = key.trim()\n if (key.startsWith('#') || key === '') continue\n process.env[key] = rest.join('=').trim()\n }\n}\n\nexport const buildPackageName = (config: ExtensionConfig) => {\n return `${config.id}_v${config.version}.${EXTENSION.pkgExtName}`\n}\n\n/**\n * build code\n */\nexport const build = async (config: UserConfig) => {\n if (config.build) config.build.watch = null\n return viteBuild({ ...config, configFile: false })\n .then(() => {\n // output\n // console.log(output)\n return true\n })\n .catch((error) => {\n console.log(error)\n return false\n })\n}\n"],"mappings":";;;;AAAA,IAAa,QAAQ;CACnB,QAAQ;CACR,SAAS;CACT,WAAW;CACX,SAAS;CACT,cAAc;CACd,eAAe;CACf,WAAW;CACX,qBAAqB;CACtB;;;ACTD,IAAa,YAAY;CACvB,YAAY;CACZ,eAAe;CACf,cAAc;CACd,mBAAmB;CACnB,eAAe;CACf,iBAAiB;CAClB;;;ACED,IAAa,WAAW,KAAK,KAAK,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC,GAAG;AAE/E,IAAM,aAAa,YAAoB;
|
|
1
|
+
{"version":3,"file":"utils-BN85b34y.js","names":[],"sources":["../src/state.ts","../src/constants.ts","../src/utils.ts"],"sourcesContent":["export const state = {\n srcDir: '',\n distDir: '',\n outputDir: '',\n i18nDir: '',\n resourcesDir: '',\n isIsolateMode: false,\n mainEntry: '',\n isolatePreloadEntry: '',\n}\n","export const EXTENSION = {\n pkgExtName: 'alix',\n mainifestName: 'manifest.json',\n signFileName: 'sig',\n extBundleFileName: 'ext.tgz',\n entryFileName: 'main.js',\n versionInfoName: 'version.json',\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport { build as viteBuild, type UserConfig } from 'vite'\n\nimport { EXTENSION } from './constants'\nimport { state } from './state'\nimport type { ExtensionConfig } from './types/build'\n\nexport const ROOT_DIR = path.join(import.meta.dirname.split('node_modules')[0])\n\nconst buildPath = (subPath: string) => {\n if (path.isAbsolute(subPath)) return subPath\n return path.join(ROOT_DIR, subPath)\n}\n\nexport const getConfig = async () => {\n const configPath = path.join(ROOT_DIR, 'config.ts')\n await fs.access(configPath, fs.constants.F_OK)\n const config = ((await import(`file://${configPath}`)) as { default: ExtensionConfig }).default\n\n state.srcDir = buildPath(config.buildConfig?.srcDir || 'src')\n state.distDir = buildPath(config.buildConfig?.distDir || 'dist')\n state.outputDir = buildPath(config.buildConfig?.outputDir || 'build')\n state.i18nDir = buildPath(config.buildConfig?.i18nDir || 'i18n')\n state.resourcesDir = buildPath(config.buildConfig?.resourcesDir || 'resources')\n state.isIsolateMode = config.buildConfig?.isIsolateMode || false\n if (state.isIsolateMode) {\n state.mainEntry = buildPath(config.buildConfig?.mainEntry || path.join(state.srcDir, 'main/index.ts'))\n state.isolatePreloadEntry = buildPath(\n config.buildConfig?.isolatePreloadEntry || path.join(state.srcDir, 'isolate-preload/index.ts')\n )\n } else {\n state.mainEntry = buildPath(config.buildConfig?.mainEntry || path.join(state.srcDir, 'index.ts'))\n }\n\n return config\n}\n\nexport const loadEnvFile = async () => {\n const envPath = path.join(ROOT_DIR, '.env')\n let envContent: string\n try {\n await fs.access(envPath, fs.constants.F_OK)\n envContent = (await fs.readFile(envPath, 'utf-8')).trim()\n } catch {\n return\n }\n if (!envContent) return\n const lines = envContent.split('\\n')\n for (const line of lines) {\n let [key, ...rest] = line.split('=')\n key = key.trim()\n if (key.startsWith('#') || key === '') continue\n process.env[key] = rest.join('=').trim()\n }\n}\n\nexport const buildPackageName = (config: ExtensionConfig) => {\n return `${config.id}_v${config.version}.${EXTENSION.pkgExtName}`\n}\n\n/**\n * build code\n */\nexport const build = async (config: UserConfig) => {\n if (config.build) config.build.watch = null\n return viteBuild({ ...config, configFile: false })\n .then(() => {\n // output\n // console.log(output)\n return true\n })\n .catch((error) => {\n console.log(error)\n return false\n })\n}\n"],"mappings":";;;;AAAA,IAAa,QAAQ;CACnB,QAAQ;CACR,SAAS;CACT,WAAW;CACX,SAAS;CACT,cAAc;CACd,eAAe;CACf,WAAW;CACX,qBAAqB;CACtB;;;ACTD,IAAa,YAAY;CACvB,YAAY;CACZ,eAAe;CACf,cAAc;CACd,mBAAmB;CACnB,eAAe;CACf,iBAAiB;CAClB;;;ACED,IAAa,WAAW,KAAK,KAAK,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC,GAAG;AAE/E,IAAM,aAAa,YAAoB;CACrC,IAAI,KAAK,WAAW,QAAQ,EAAE,OAAO;CACrC,OAAO,KAAK,KAAK,UAAU,QAAQ;;AAGrC,IAAa,YAAY,YAAY;;CACnC,MAAM,aAAa,KAAK,KAAK,UAAU,YAAY;CACnD,MAAM,GAAG,OAAO,YAAY,GAAG,UAAU,KAAK;CAC9C,MAAM,UAAW,MAAM,OAAO,UAAU,eAAgD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SAAS,QAAQ,EAAE,MAAM;SACnD;EACN;;CAEF,IAAI,CAAC,YAAY;CACjB,MAAM,QAAQ,WAAW,MAAM,KAAK;CACpC,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,KAAK,GAAG,QAAQ,KAAK,MAAM,IAAI;EACpC,MAAM,IAAI,MAAM;EAChB,IAAI,IAAI,WAAW,IAAI,IAAI,QAAQ,IAAI;EACvC,QAAQ,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,MAAM;;;AAI5C,IAAa,oBAAoB,WAA4B;CAC3D,OAAO,GAAG,OAAO,GAAG,IAAI,OAAO,QAAQ,GAAG,UAAU;;;;;AAMtD,IAAa,UAAQ,OAAO,WAAuB;CACjD,IAAI,OAAO,OAAO,OAAO,MAAM,QAAQ;CACvC,OAAO,MAAU;EAAE,GAAG;EAAQ,YAAY;EAAO,CAAC,CAC/C,WAAW;EAGV,OAAO;GACP,CACD,OAAO,UAAU;EAChB,QAAQ,IAAI,MAAM;EAClB,OAAO;GACP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@any-listen/extension-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"any-listen",
|
|
6
6
|
"any-listen-extension"
|
|
@@ -61,21 +61,21 @@
|
|
|
61
61
|
"@eslint/js": "^9.39.4",
|
|
62
62
|
"@tsconfig/node24": "^24.0.4",
|
|
63
63
|
"@tsconfig/recommended": "^1.0.13",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
65
|
-
"@typescript-eslint/parser": "^8.
|
|
66
|
-
"eslint-config-love": "^
|
|
67
|
-
"globals": "^17.
|
|
68
|
-
"tar": "^7.5.
|
|
69
|
-
"vite": "^8.0.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.59.2",
|
|
65
|
+
"@typescript-eslint/parser": "^8.59.2",
|
|
66
|
+
"eslint-config-love": "^154.0.0",
|
|
67
|
+
"globals": "^17.6.0",
|
|
68
|
+
"tar": "^7.5.14",
|
|
69
|
+
"vite": "^8.0.11"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^25.6.0",
|
|
73
73
|
"eslint": "^9.39.4",
|
|
74
|
-
"oxfmt": "^0.
|
|
74
|
+
"oxfmt": "^0.48.0",
|
|
75
75
|
"typescript": "^5.9.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"eslint": "^9.39.4"
|
|
79
79
|
},
|
|
80
|
-
"packageManager": "pnpm@10.33.
|
|
80
|
+
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800"
|
|
81
81
|
}
|
package/types/app/api.d.ts
CHANGED
|
@@ -568,14 +568,40 @@ declare namespace AnyListen {
|
|
|
568
568
|
isCollect: boolean
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
}
|
|
572
571
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
572
|
+
namespace Resource {
|
|
573
|
+
interface SongListItem {
|
|
574
|
+
play_count: string
|
|
575
|
+
id: string
|
|
576
|
+
author: string
|
|
577
|
+
name: string
|
|
578
|
+
time?: string
|
|
579
|
+
img: string
|
|
580
|
+
// grade: basic.favorcnt / 10,
|
|
581
|
+
desc: string | null
|
|
582
|
+
total?: number
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
interface CommonItem {
|
|
586
|
+
id: string
|
|
587
|
+
name: string
|
|
588
|
+
}
|
|
589
|
+
type TagItem = CommonItem
|
|
590
|
+
interface TagGroupItem {
|
|
591
|
+
name: string
|
|
592
|
+
list: CommonItem[]
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
type BoardItem = CommonItem
|
|
596
|
+
}
|
|
578
597
|
}
|
|
598
|
+
|
|
599
|
+
// interface IPCActionBase<A> {
|
|
600
|
+
// action: A
|
|
601
|
+
// }
|
|
602
|
+
// interface IPCActionData<A, D> extends IPCActionBase<A> {
|
|
603
|
+
// data: D
|
|
604
|
+
// }
|
|
579
605
|
interface CommonParams {
|
|
580
606
|
extensionId: string
|
|
581
607
|
source: string
|
|
@@ -584,6 +610,11 @@ interface CommonListParams extends CommonParams {
|
|
|
584
610
|
page: number
|
|
585
611
|
limit: number
|
|
586
612
|
}
|
|
613
|
+
interface MusicSearchParams extends CommonListParams {
|
|
614
|
+
name: string
|
|
615
|
+
artist?: string
|
|
616
|
+
albumName?: string
|
|
617
|
+
}
|
|
587
618
|
interface LyricSearchParams extends CommonParams {
|
|
588
619
|
name: string
|
|
589
620
|
artist?: string
|
|
@@ -594,7 +625,7 @@ interface LyricSearchResult {
|
|
|
594
625
|
name: string
|
|
595
626
|
artist?: string
|
|
596
627
|
interval?: number
|
|
597
|
-
lyric?:
|
|
628
|
+
lyric?: AnyListen.Music.LyricInfo
|
|
598
629
|
}
|
|
599
630
|
interface LyricDetailParams extends CommonParams {
|
|
600
631
|
id: string
|
|
@@ -602,10 +633,10 @@ interface LyricDetailParams extends CommonParams {
|
|
|
602
633
|
interface PicSearchParams extends CommonParams {
|
|
603
634
|
name: string
|
|
604
635
|
artist?: string
|
|
636
|
+
interval?: number
|
|
605
637
|
}
|
|
606
|
-
interface
|
|
607
|
-
|
|
608
|
-
artist?: string
|
|
638
|
+
interface SonglistSearchParams extends CommonListParams {
|
|
639
|
+
keyword: string
|
|
609
640
|
}
|
|
610
641
|
interface ListDetailParams extends CommonListParams {
|
|
611
642
|
id: string
|
|
@@ -614,6 +645,33 @@ interface SonglistListParams extends CommonListParams {
|
|
|
614
645
|
sort: string
|
|
615
646
|
tag: string
|
|
616
647
|
}
|
|
648
|
+
interface LeaderboardDateParams extends CommonParams {
|
|
649
|
+
id: string
|
|
650
|
+
}
|
|
651
|
+
interface LeaderboardDetailParams extends CommonListParams {
|
|
652
|
+
id: string
|
|
653
|
+
date: string
|
|
654
|
+
}
|
|
655
|
+
interface MusicCommentParams extends CommonListParams {
|
|
656
|
+
musicInfo: AnyListen.Music.MusicInfoOnline
|
|
657
|
+
id?: string
|
|
658
|
+
type: 'hot' | 'new' | 'reply'
|
|
659
|
+
}
|
|
660
|
+
export interface MusicComment {
|
|
661
|
+
id: string
|
|
662
|
+
userId?: string
|
|
663
|
+
userName: string
|
|
664
|
+
text: string
|
|
665
|
+
time?: number
|
|
666
|
+
images?: string[]
|
|
667
|
+
location?: string
|
|
668
|
+
avatar?: string
|
|
669
|
+
likedCount?: number
|
|
670
|
+
skipPage?: boolean
|
|
671
|
+
replyTotal?: number
|
|
672
|
+
reply?: MusicComment[]
|
|
673
|
+
replySkipPage?: boolean
|
|
674
|
+
}
|
|
617
675
|
export interface ListCommonResult<T> {
|
|
618
676
|
list: T[]
|
|
619
677
|
total: number
|
|
@@ -628,34 +686,6 @@ interface MusicUrlParams extends MusicCommonParams {
|
|
|
628
686
|
quality?: string
|
|
629
687
|
type?: AnyListen.Music.FileType
|
|
630
688
|
}
|
|
631
|
-
interface MusicUrlInfo {
|
|
632
|
-
url: string
|
|
633
|
-
quality: string
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
interface SongListItem {
|
|
637
|
-
play_count: string
|
|
638
|
-
id: string
|
|
639
|
-
author: string
|
|
640
|
-
name: string
|
|
641
|
-
time?: string
|
|
642
|
-
img: string
|
|
643
|
-
// grade: basic.favorcnt / 10,
|
|
644
|
-
desc: string | null
|
|
645
|
-
total?: string
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
interface CommonItem {
|
|
649
|
-
id: string
|
|
650
|
-
name: string
|
|
651
|
-
}
|
|
652
|
-
type TagItem = CommonItem
|
|
653
|
-
interface TagGroupItem {
|
|
654
|
-
name: string
|
|
655
|
-
list: CommonItem[]
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
type BoardItem = CommonItem
|
|
659
689
|
|
|
660
690
|
declare global {
|
|
661
691
|
namespace AnyListen_API {
|
|
@@ -704,6 +734,11 @@ declare global {
|
|
|
704
734
|
type Quality = '128k' | '320k' | 'flac' | 'flac24bit' | '192k' | 'wav' | 'dobly' | 'master'
|
|
705
735
|
type MusicInfo = AnyListen.Music.MusicInfo
|
|
706
736
|
type MusicInfoOnline = AnyListen.Music.MusicInfoOnline
|
|
737
|
+
type SongListItem = AnyListen.Resource.SongListItem
|
|
738
|
+
type CommonItem = AnyListen.Resource.CommonItem
|
|
739
|
+
type TagItem = AnyListen.Resource.TagItem
|
|
740
|
+
type TagGroupItem = AnyListen.Resource.TagGroupItem
|
|
741
|
+
type BoardItem = AnyListen.Resource.BoardItem
|
|
707
742
|
|
|
708
743
|
type ParamsData = Record<string, string | number | null | undefined | boolean>
|
|
709
744
|
interface RequestOptions {
|
|
@@ -997,22 +1032,24 @@ declare global {
|
|
|
997
1032
|
type MusicSearchResult = ListCommonResult<AnyListen.Music.MusicInfoOnline>
|
|
998
1033
|
|
|
999
1034
|
interface ResourceAction {
|
|
1000
|
-
|
|
1001
|
-
|
|
1035
|
+
tipSearch: (params: CommonParams) => Promise<string[]>
|
|
1036
|
+
hotSearch: (params: CommonParams) => Promise<string[]>
|
|
1037
|
+
musicSearch: (params: MusicSearchParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
|
|
1002
1038
|
musicPic: (params: MusicCommonParams) => Promise<string>
|
|
1003
1039
|
musicUrl: (params: MusicUrlParams) => Promise<MusicUrlInfo>
|
|
1004
1040
|
musicLyric: (params: MusicCommonParams) => Promise<AnyListen.Music.LyricInfo>
|
|
1005
1041
|
musicPicSearch: (params: PicSearchParams) => Promise<string[]>
|
|
1006
1042
|
lyricSearch: (params: LyricSearchParams) => Promise<LyricSearchResult[]>
|
|
1007
1043
|
lyricDetail: (params: LyricDetailParams) => Promise<AnyListen.Music.LyricInfo>
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1044
|
+
songlistSearch: (params: SonglistSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
|
|
1045
|
+
songlistSorts: (params: CommonParams) => Promise<AnyListen.Resource.TagItem[]>
|
|
1046
|
+
songlistTags: (params: CommonParams) => Promise<AnyListen.Resource.TagGroupItem[]>
|
|
1047
|
+
songlist: (params: SonglistListParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
|
|
1048
|
+
songlistDetail: (params: ListDetailParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
|
|
1049
|
+
leaderboard: (params: CommonParams) => Promise<AnyListen.Resource.TagGroupItem[]>
|
|
1050
|
+
leaderboardDate: (params: LeaderboardDateParams) => Promise<AnyListen.Resource.TagItem[]>
|
|
1051
|
+
leaderboardDetail: (params: LeaderboardDetailParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
|
|
1052
|
+
musicComment: (params: MusicCommentParams) => Promise<ListCommonResult<MusicComment>>
|
|
1016
1053
|
}
|
|
1017
1054
|
|
|
1018
1055
|
interface BackupDataAction {
|