diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 076be9c839..67206ad8d6 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -14,7 +14,47 @@ on: workflow_dispatch: jobs: + pack: + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Setup + run: npm i -g @antfu/ni + + - name: Setup PNPM + uses: pnpm/action-setup@v2 + + - name: Install + run: nci + env: + CYPRESS_INSTALL_BINARY: 0 + + - name: Build + run: nr build + + - name: Pack + run: node ./scripts/pack.mjs /tmp/slidev-pkgs + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: slidev-packages + path: /tmp/slidev-pkgs + test: + needs: pack timeout-minutes: 10 runs-on: ${{ matrix.os }} @@ -22,7 +62,7 @@ jobs: matrix: node-version: [18.x] os: [ubuntu-latest, windows-latest] - pm: [yarn, npm, pnpm] + pm: [npm, pnpm] # yarn not working in this CI hoist: [true, false] steps: @@ -33,10 +73,10 @@ jobs: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 20.x uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20.x - name: Setup run: npm i -g @antfu/ni @@ -47,15 +87,15 @@ jobs: - name: Install run: nci - - name: Build - run: nr build - - - name: Pack - run: node ./scripts/pack.mjs ../temp/slidev-pkgs + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: slidev-packages + path: /tmp/slidev-pkgs - name: Create new project run: | - npm i -g ../temp/slidev-pkgs/create-app.tgz + npm i -g /tmp/slidev-pkgs/create-app.tgz echo "N" | create-slidev ../temp/slidev-project - name: Remove npmrc @@ -68,12 +108,12 @@ jobs: working-directory: ../temp/slidev-project - name: Install project (npm, pnpm) - run: ${{ matrix.pm }} i ../slidev-pkgs/cli.tgz playwright-chromium + run: ${{ matrix.pm }} i /tmp/slidev-pkgs/cli.tgz playwright-chromium working-directory: ../temp/slidev-project if: ${{ matrix.pm != 'yarn' }} - name: Install project (yarn) - run: yarn add ../slidev-pkgs/cli.tgz playwright-chromium + run: yarn add /tmp/slidev-pkgs/cli.tgz playwright-chromium working-directory: ../temp/slidev-project if: ${{ matrix.pm == 'yarn' }} @@ -92,7 +132,7 @@ jobs: - name: Install globally run: | - ${{ matrix.pm }} i -g ${{ github.workspace }}/../temp/slidev-pkgs/cli.tgz playwright-chromium + ${{ matrix.pm }} i -g /tmp/slidev-pkgs/cli.tgz playwright-chromium ${{ matrix.pm }} i -g @slidev/theme-seriph if: ${{ matrix.pm != 'yarn' }} diff --git a/packages/client/package.json b/packages/client/package.json index 3a1736cdb7..4d9a208a8f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -59,7 +59,6 @@ "typescript": "^5.4.5", "unocss": "^0.59.3", "vue": "^3.4.22", - "vue-demi": "^0.14.7", "vue-router": "^4.3.0", "yaml": "^2.4.1" }, diff --git a/packages/client/uno.config.ts b/packages/client/uno.config.ts index 8fd9395e96..ee9c0f5ecf 100644 --- a/packages/client/uno.config.ts +++ b/packages/client/uno.config.ts @@ -9,6 +9,7 @@ import { transformerVariantGroup, } from 'unocss' import { variantMatcher } from '@unocss/preset-mini/utils' +import extractorMdc from '@unocss/extractor-mdc' export default defineConfig({ safelist: [ @@ -48,4 +49,7 @@ export default defineConfig({ transformerDirectives({ enforce: 'pre' }), transformerVariantGroup(), ], + extractors: [ + extractorMdc(), + ], }) diff --git a/packages/parser/package.json b/packages/parser/package.json index be2f7c21bf..4fff3bc6c2 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -44,6 +44,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { + "@antfu/utils": "^0.7.7", "@slidev/types": "workspace:*", "yaml": "^2.4.1" } diff --git a/packages/slidev/node/cli.ts b/packages/slidev/node/cli.ts index 61966b85c1..5ea20d9d51 100644 --- a/packages/slidev/node/cli.ts +++ b/packages/slidev/node/cli.ts @@ -11,7 +11,6 @@ import yargs from 'yargs' import { blue, bold, cyan, dim, gray, green, underline, yellow } from 'kolorist' import type { LogLevel, ViteDevServer } from 'vite' import type { ResolvedSlidevOptions, SlidevConfig, SlidevData, SlidevPreparserExtension } from '@slidev/types' -import isInstalledGlobally from 'is-installed-globally' import equal from 'fast-deep-equal' import { verifyConfig } from '@slidev/parser' import { injectPreparserExtensionLoader } from '@slidev/parser/fs' @@ -23,7 +22,7 @@ import { resolveOptions } from './options' import { getThemeMeta, resolveTheme } from './integrations/themes' import { parser } from './parser' import { loadSetups } from './setups/load' -import { getRoots, resolveEntry } from './resolver' +import { getRoots, isInstalledGlobally, resolveEntry } from './resolver' import { resolveAddons } from './integrations/addons' const CONFIG_RESTART_FIELDS: (keyof SlidevConfig)[] = [ @@ -623,7 +622,7 @@ function printInfo( console.log() console.log() console.log(` ${cyan('●') + blue('■') + yellow('▲')}`) - console.log(`${bold(' Slidev')} ${blue(`v${version}`)} ${isInstalledGlobally ? yellow('(global)') : ''}`) + console.log(`${bold(' Slidev')} ${blue(`v${version}`)} ${isInstalledGlobally.value ? yellow('(global)') : ''}`) console.log() verifyConfig(options.data.config, options.data.themeMeta, v => console.warn(yellow(` ! ${v}`))) diff --git a/packages/slidev/node/resolver.ts b/packages/slidev/node/resolver.ts index 68beb4a89d..28f4c34738 100644 --- a/packages/slidev/node/resolver.ts +++ b/packages/slidev/node/resolver.ts @@ -1,11 +1,10 @@ -import { dirname, join, resolve } from 'node:path' +import { dirname, join, relative, resolve } from 'node:path' import * as fs from 'node:fs' import process from 'node:process' import { fileURLToPath } from 'node:url' import { ensurePrefix, slash } from '@antfu/utils' -import isInstalledGlobally from 'is-installed-globally' import { resolveGlobal } from 'resolve-global' -import { findDepPkgJsonPath } from 'vitefu' +import { findClosestPkgJsonPath, findDepPkgJsonPath } from 'vitefu' import { resolvePath } from 'mlly' import globalDirs from 'global-directory' import prompts from 'prompts' @@ -15,6 +14,8 @@ import type { RootsInfo } from '@slidev/types' const cliRoot = fileURLToPath(new URL('..', import.meta.url)) +export const isInstalledGlobally: { value?: boolean } = {} + /** * Resolve path for import url on Vite client side */ @@ -39,7 +40,7 @@ export async function resolveImportPath(importName: string, ensure = false) { } catch { } - if (isInstalledGlobally) { + if (isInstalledGlobally.value) { try { return resolveGlobal(importName) } @@ -57,7 +58,7 @@ export async function findPkgRoot(dep: string, parent: string, ensure: true): Pr export async function findPkgRoot(dep: string, parent: string, ensure?: boolean): Promise export async function findPkgRoot(dep: string, parent: string, ensure = false) { const pkgJsonPath = await findDepPkgJsonPath(dep, parent) - const path = pkgJsonPath ? dirname(pkgJsonPath) : isInstalledGlobally ? await findGlobalPkgRoot(dep, false) : undefined + const path = pkgJsonPath ? dirname(pkgJsonPath) : isInstalledGlobally.value ? await findGlobalPkgRoot(dep, false) : undefined if (ensure && !path) throw new Error(`Failed to resolve package "${dep}"`) return path @@ -104,13 +105,13 @@ export function createResolver(type: 'theme' | 'addon', officials: Record { return rootsInfo if (!entry) throw new Error('[slidev] Cannot find roots without entry') - const clientRoot = await findPkgRoot('@slidev/client', cliRoot, true) const userRoot = dirname(entry) - const userPkgJson = getUserPkgJson(userRoot) - const userWorkspaceRoot = searchForWorkspaceRoot(userRoot) + isInstalledGlobally.value + = !/^(\.\.\/)*node_modules\//i.test(slash(relative(userRoot, cliRoot))) + || (await import('is-installed-globally')).default + const clientRoot = await findPkgRoot('@slidev/client', cliRoot, true) + const closestPkgRoot = dirname(await findClosestPkgJsonPath(userRoot) || userRoot) + const userPkgJson = getUserPkgJson(closestPkgRoot) + const userWorkspaceRoot = searchForWorkspaceRoot(closestPkgRoot) rootsInfo = { cliRoot, clientRoot, diff --git a/packages/slidev/node/vite/extendConfig.ts b/packages/slidev/node/vite/extendConfig.ts index b92ceacef8..7b7b45e752 100644 --- a/packages/slidev/node/vite/extendConfig.ts +++ b/packages/slidev/node/vite/extendConfig.ts @@ -1,17 +1,36 @@ import { join } from 'node:path' +import { fileURLToPath, pathToFileURL } from 'node:url' import type { InlineConfig, Plugin } from 'vite' import { mergeConfig } from 'vite' -import isInstalledGlobally from 'is-installed-globally' -import { uniq } from '@antfu/utils' +import { slash, uniq } from '@antfu/utils' import type { ResolvedSlidevOptions } from '@slidev/types' +import { createResolve } from 'mlly' import { getIndexHtml } from '../commands/shared' -import { resolveImportPath, toAtFS } from '../resolver' -import { dependencies } from '../../../client/package.json' +import { isInstalledGlobally, resolveImportPath, toAtFS } from '../resolver' + +const INCLUDE_GLOBAL = [ + '@shikijs/monaco', + '@shikijs/vitepress-twoslash/client', + '@slidev/rough-notation', + '@typescript/ata', + '@unhead/vue', + 'drauu', + 'file-saver', + 'floating-vue', + 'fuse.js', + 'lz-string', + 'prettier', + 'recordrtc', + 'typescript', + 'vue-router', + 'yaml', + 'shiki-magic-move/vue', +] -const INCLUDE = [ - ...Object.keys(dependencies), +const INCLUDE_LOCAL = [ + ...INCLUDE_GLOBAL, - // CodeMirror + 'codemirror', 'codemirror/mode/javascript/javascript', 'codemirror/mode/css/css', 'codemirror/mode/markdown/markdown', @@ -19,30 +38,45 @@ const INCLUDE = [ 'codemirror/mode/htmlmixed/htmlmixed', 'codemirror/addon/display/placeholder', - // Monaco - 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices', + 'monaco-editor', 'monaco-editor/esm/vs/platform/contextview/browser/contextViewService', 'monaco-editor/esm/vs/platform/instantiation/common/descriptors', + 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices', +].map(i => `@slidev/cli > @slidev/client > ${i}`) - // Others - 'shiki-magic-move/vue', -] - -const EXCLUDE = [ - '@slidev/shared', +const EXCLUDE_GLOBAL = [ '@slidev/types', '@slidev/client', '@slidev/client/constants', '@slidev/client/logic/dark', + '@antfu/utils', '@vueuse/core', '@vueuse/math', '@vueuse/shared', + '@vueuse/motion', '@unocss/reset', - 'unocss', 'mermaid', 'vue-demi', 'vue', - 'shiki', +] + +const EXCLUDE_LOCAL = [ + ...EXCLUDE_GLOBAL, + ...[ + '@slidev/client', + '@slidev/client/constants', + '@slidev/client/logic/dark', + '@slidev/client > @antfu/utils', + '@slidev/client > @slidev/types', + '@slidev/client > @vueuse/core', + '@slidev/client > @vueuse/math', + '@slidev/client > @vueuse/shared', + '@slidev/client > @vueuse/motion', + '@slidev/client > @unocss/reset', + '@slidev/client > mermaid', + '@slidev/client > vue-demi', + '@slidev/client > vue', + ].map(i => `@slidev/cli > ${i}`), ] const ASYNC_MODULES = [ @@ -52,6 +86,11 @@ const ASYNC_MODULES = [ ] export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin { + const resolveClientDep = createResolve({ + // Same as Vite's default resolve conditions + conditions: ['import', 'module', 'browser', 'default', options.mode === 'build' ? 'production' : 'development'], + url: pathToFileURL(options.clientRoot), + }) return { name: 'slidev:config', async config(config) { @@ -75,16 +114,26 @@ export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin { find: 'vue', replacement: await resolveImportPath('vue/dist/vue.esm-bundler.js', true), }, + ...(isInstalledGlobally.value + ? await Promise.all(INCLUDE_GLOBAL.map(async dep => ({ + find: dep, + replacement: fileURLToPath(await resolveClientDep(dep)), + }))) + : [] + ), ], dedupe: ['vue'], }, - optimizeDeps: { - exclude: EXCLUDE, - include: INCLUDE - .filter(i => !EXCLUDE.includes(i)) + optimizeDeps: isInstalledGlobally.value + ? { + exclude: EXCLUDE_GLOBAL, + include: INCLUDE_GLOBAL, + } + : { // We need to specify the full deps path for non-hoisted modules - .map(i => `@slidev/cli > @slidev/client > ${i}`), - }, + exclude: EXCLUDE_LOCAL, + include: INCLUDE_LOCAL, + }, css: options.data.config.css === 'unocss' ? { postcss: { @@ -99,8 +148,11 @@ export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin { strict: true, allow: uniq([ options.userWorkspaceRoot, - options.cliRoot, options.clientRoot, + // Special case for PNPM global installation + isInstalledGlobally.value + ? slash(options.cliRoot).replace(/\/\.pnpm\/.*$/ig, '') + : options.cliRoot, ...options.roots, ]), }, @@ -158,7 +210,7 @@ export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin { // return nodeModuelsMatch[nodeModuelsMatch.length - 1][1] // } - if (isInstalledGlobally) { + if (isInstalledGlobally.value) { injection.cacheDir = join(options.cliRoot, 'node_modules/.vite') injection.root = options.cliRoot } diff --git a/packages/slidev/package.json b/packages/slidev/package.json index d3dda40c11..3005297b87 100644 --- a/packages/slidev/package.json +++ b/packages/slidev/package.json @@ -60,7 +60,7 @@ "@slidev/client": "workspace:*", "@slidev/parser": "workspace:*", "@slidev/types": "workspace:*", - "@unocss/extractor-mdc": "^0.59.3", + "@unocss/extractor-mdc": "^0.59.4", "@unocss/reset": "^0.59.3", "@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue-jsx": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index acac459205..f37dea4c1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -395,9 +395,6 @@ importers: vue: specifier: ^3.4.22 version: 3.4.22(typescript@5.4.5) - vue-demi: - specifier: ^0.14.7 - version: 0.14.7(vue@3.4.22) vue-router: specifier: ^4.3.0 version: 4.3.0(vue@3.4.22) @@ -438,6 +435,9 @@ importers: packages/parser: dependencies: + '@antfu/utils': + specifier: ^0.7.7 + version: 0.7.7 '@slidev/types': specifier: workspace:* version: link:../types @@ -484,8 +484,8 @@ importers: specifier: workspace:* version: link:../types '@unocss/extractor-mdc': - specifier: ^0.59.3 - version: 0.59.3 + specifier: ^0.59.4 + version: 0.59.4 '@unocss/reset': specifier: ^0.59.3 version: 0.59.3 @@ -509,7 +509,7 @@ importers: version: 3.7.0 debug: specifier: ^4.3.4 - version: 4.3.4(supports-color@8.1.1) + version: 4.3.4(supports-color@5.5.0) fast-deep-equal: specifier: ^3.1.3 version: 3.1.3 @@ -996,7 +996,7 @@ packages: '@babel/traverse': 7.24.1 '@babel/types': 7.24.0 convert-source-map: 2.0.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -1244,7 +1244,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.24.4 '@babel/types': 7.24.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -1818,7 +1818,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) espree: 9.6.1 globals: 13.24.0 ignore: 5.3.1 @@ -1835,7 +1835,7 @@ packages: engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) espree: 10.0.1 globals: 14.0.0 ignore: 5.3.1 @@ -1886,7 +1886,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -1951,7 +1951,7 @@ packages: '@antfu/install-pkg': 0.1.1 '@antfu/utils': 0.5.2 '@iconify/types': 1.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) kolorist: 1.8.0 local-pkg: 0.4.3 transitivePeerDependencies: @@ -1964,7 +1964,7 @@ packages: '@antfu/install-pkg': 0.1.1 '@antfu/utils': 0.7.7 '@iconify/types': 2.0.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) kolorist: 1.8.0 local-pkg: 0.5.0 mlly: 1.6.1 @@ -2748,7 +2748,7 @@ packages: '@typescript-eslint/type-utils': 7.6.0(eslint@9.0.0)(typescript@5.4.5) '@typescript-eslint/utils': 7.6.0(eslint@9.0.0)(typescript@5.4.5) '@typescript-eslint/visitor-keys': 7.6.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) eslint: 9.0.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -2774,7 +2774,7 @@ packages: '@typescript-eslint/types': 7.6.0 '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.4.5) '@typescript-eslint/visitor-keys': 7.6.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) eslint: 9.0.0 typescript: 5.4.5 transitivePeerDependencies: @@ -2809,7 +2809,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.4.5) '@typescript-eslint/utils': 7.6.0(eslint@9.0.0)(typescript@5.4.5) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) eslint: 9.0.0 ts-api-utils: 1.3.0(typescript@5.4.5) typescript: 5.4.5 @@ -2838,7 +2838,7 @@ packages: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -2860,7 +2860,7 @@ packages: dependencies: '@typescript-eslint/types': 7.6.0 '@typescript-eslint/visitor-keys': 7.6.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.4 @@ -2936,7 +2936,7 @@ packages: /@typescript/vfs@1.5.0: resolution: {integrity: sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3072,8 +3072,8 @@ packages: dependencies: '@unocss/core': 0.59.3 - /@unocss/extractor-mdc@0.59.3: - resolution: {integrity: sha512-vl0zf6GkLKGSzlQxUy+WCLGvI8ojenVjNbmJrSGzvQZxDJf0ZZuk/dJ2n/Zk0p88wJC45+r8sbKBuevYkB0peA==} + /@unocss/extractor-mdc@0.59.4: + resolution: {integrity: sha512-W0F3EuNCvWhpVOMH2ZHvPM2Nq+eJhsp02cqlmf86RUqcQ912R1FySXUJTWu3D91Dmtr4YpEMNsUV8iLsscWRTA==} dev: false /@unocss/inspector@0.42.1: @@ -3750,7 +3750,7 @@ packages: /@windicss/config@1.9.3: resolution: {integrity: sha512-u8GUjsfC9r5X1AGYhzb1lX3zZj8wqk6SH1DYex8XUGmZ1M2UpvnUPOFi63XFViduspQ6l2xTX84QtG+lUzhEoQ==} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) jiti: 1.21.0 windicss: 3.5.6 transitivePeerDependencies: @@ -3762,7 +3762,7 @@ packages: dependencies: '@antfu/utils': 0.7.7 '@windicss/config': 1.9.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) fast-glob: 3.3.2 magic-string: 0.30.9 micromatch: 4.0.5 @@ -4856,7 +4856,6 @@ packages: dependencies: ms: 2.1.2 supports-color: 5.5.0 - dev: true /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} @@ -4869,6 +4868,7 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 + dev: true /decode-named-character-reference@1.0.2: resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==} @@ -5539,7 +5539,7 @@ packages: eslint: ^8.56.0 || ^9.0.0-0 dependencies: '@typescript-eslint/utils': 7.6.0(eslint@9.0.0)(typescript@5.4.5) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 eslint: 9.0.0 eslint-import-resolver-node: 0.3.9 @@ -5561,7 +5561,7 @@ packages: '@es-joy/jsdoccomment': 0.42.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) escape-string-regexp: 4.0.0 eslint: 9.0.0 esquery: 1.5.0 @@ -5656,7 +5656,7 @@ packages: peerDependencies: eslint: '>=6.0.0' dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) eslint: 9.0.0 eslint-compat-utils: 0.5.0(eslint@9.0.0) lodash: 4.17.21 @@ -5754,7 +5754,7 @@ packages: peerDependencies: eslint: '>=6.0.0' dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) eslint: 9.0.0 eslint-compat-utils: 0.5.0(eslint@9.0.0) lodash: 4.17.21 @@ -5820,7 +5820,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) escape-string-regexp: 4.0.0 eslint-scope: 8.0.1 eslint-visitor-keys: 4.0.0 @@ -6143,7 +6143,7 @@ packages: debug: optional: true dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) dev: false /foreground-child@3.1.1: @@ -6458,6 +6458,7 @@ packages: /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} + dev: true /has-property-descriptors@1.0.1: resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} @@ -6994,7 +6995,7 @@ packages: dependencies: chalk: 5.3.0 commander: 11.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) execa: 8.0.1 lilconfig: 3.0.0 listr2: 8.0.1 @@ -7702,7 +7703,7 @@ packages: /micromark@2.11.4: resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) parse-entities: 2.0.0 transitivePeerDependencies: - supports-color @@ -7712,7 +7713,7 @@ packages: resolution: {integrity: sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==} dependencies: '@types/debug': 4.1.12 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) decode-named-character-reference: 1.0.2 micromark-core-commonmark: 1.1.0 micromark-factory-space: 1.1.0 @@ -7735,7 +7736,7 @@ packages: resolution: {integrity: sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==} dependencies: '@types/debug': 4.1.12 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.0 @@ -9121,6 +9122,7 @@ packages: engines: {node: '>=10'} dependencies: has-flag: 4.0.0 + dev: true /supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} @@ -9335,7 +9337,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.6.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -9706,7 +9708,7 @@ packages: '@antfu/utils': 0.7.7 '@iconify/utils': 2.1.22 '@vue/compiler-sfc': 3.4.22 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) kolorist: 1.8.0 local-pkg: 0.5.0 unplugin: 1.10.1 @@ -9729,7 +9731,7 @@ packages: '@antfu/utils': 0.7.7 '@rollup/pluginutils': 5.1.0 chokidar: 3.6.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) fast-glob: 3.3.2 local-pkg: 0.4.3 magic-string: 0.30.9 @@ -9886,7 +9888,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) pathe: 1.1.2 picocolors: 1.0.0 vite: 5.2.9(@types/node@20.12.7) @@ -9913,7 +9915,7 @@ packages: dependencies: '@antfu/utils': 0.7.7 '@rollup/pluginutils': 5.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) error-stack-parser-es: 0.1.1 fs-extra: 11.2.0 open: 10.1.0 @@ -9938,7 +9940,7 @@ packages: dependencies: '@antfu/utils': 0.7.7 '@rollup/pluginutils': 5.1.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) error-stack-parser-es: 0.1.1 fs-extra: 11.2.0 open: 10.1.0 @@ -9959,7 +9961,7 @@ packages: '@antfu/utils': 0.7.7 axios: 1.6.5(debug@4.3.4) blueimp-md5: 2.19.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) fs-extra: 11.2.0 magic-string: 0.30.9 vite: 5.2.9(@types/node@20.12.7) @@ -9987,7 +9989,7 @@ packages: vue: ^3.0.0 dependencies: '@antfu/utils': 0.7.7 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) klona: 2.0.6 mlly: 1.6.1 ufo: 1.5.3 @@ -10003,7 +10005,7 @@ packages: vite: ^2.0.1 || ^3.0.0 || ^4.0.0 || ^5.0.0 dependencies: '@windicss/plugin-utils': 1.9.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) kolorist: 1.8.0 vite: 3.2.8(@types/node@20.12.7) windicss: 3.5.6 @@ -10180,7 +10182,7 @@ packages: '@vitest/utils': 1.5.0 acorn-walk: 8.3.2 chai: 4.4.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.9 @@ -10223,7 +10225,7 @@ packages: peerDependencies: eslint: '>=6.0.0' dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) eslint: 9.0.0 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 diff --git a/scripts/pack.mjs b/scripts/pack.mjs index 9889857241..5adac8de64 100644 --- a/scripts/pack.mjs +++ b/scripts/pack.mjs @@ -1,9 +1,9 @@ -import { join } from 'node:path' +import { resolve } from 'node:path' import process from 'node:process' import { $, argv, cd, fs } from 'zx' const WORKSPACE_ROOT = process.cwd() -const PKG_ROOT = join(WORKSPACE_ROOT, argv._[0]) +const PKG_ROOT = resolve(WORKSPACE_ROOT, argv._[0]) const packages = { 'types': './packages/types', @@ -34,7 +34,7 @@ async function pack() { await fs.mkdir(PKG_ROOT, { recursive: true }) for (const [name, path] of Object.entries(packages)) { console.log('[pack] pack', path) - cd(join(WORKSPACE_ROOT, path)) + cd(resolve(WORKSPACE_ROOT, path)) const { stdout } = await $`pnpm pack` await fs.move(stdout.trim(), `${PKG_ROOT}/${name}.tgz`) }