From 82c2938d1d7305c37def5d68109d9d088687cd5d Mon Sep 17 00:00:00 2001 From: weishanchao <18178209323@163.com> Date: Mon, 12 Aug 2024 10:50:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dframework=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/__tests__/doctor-config.spec.ts | 5 +++-- packages/taro-cli/src/__tests__/utils/index.ts | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/taro-cli/src/__tests__/doctor-config.spec.ts b/packages/taro-cli/src/__tests__/doctor-config.spec.ts index 07f48bbb967c..0a9c5b381938 100644 --- a/packages/taro-cli/src/__tests__/doctor-config.spec.ts +++ b/packages/taro-cli/src/__tests__/doctor-config.spec.ts @@ -1,6 +1,7 @@ import * as helper from '@tarojs/helper' import doctor from '../doctor' +import { validateFramework } from './utils/index' const validator = doctor.validators[1] const baseConfig = { @@ -49,7 +50,7 @@ describe('config validator of doctor', () => { expect(messages.length).toEqual(3) msgs = messages.map(line => line.content) - expect(msgs.includes('framework 的值 "" 与任何指定选项 ["nerv","react","preact","solid","vue","vue3","none"] 都不匹配')).toBeTruthy() + expect(validateFramework(msgs)).toBeTruthy() }) it('date', async () => { @@ -93,7 +94,7 @@ describe('config validator of doctor', () => { framework: 'other' })) expect(res.messages.length).toEqual(3) - expect(res.messages[2].content).toEqual('framework 的值 "other" 与任何指定选项 ["nerv","react","preact","solid","vue","vue3","none"] 都不匹配') + expect(validateFramework(res.messages[2].content)).toEqual(true) }) it('designWidth', async () => { diff --git a/packages/taro-cli/src/__tests__/utils/index.ts b/packages/taro-cli/src/__tests__/utils/index.ts index 6dc71ae687f3..8616ef897425 100644 --- a/packages/taro-cli/src/__tests__/utils/index.ts +++ b/packages/taro-cli/src/__tests__/utils/index.ts @@ -52,3 +52,8 @@ export function run (name: string, presets: string[] = []): IRun { return kernel } } + +export function validateFramework(value: string) { + const frameworkRegex = /(nerv|react|preact|solid|vue|vue3|none)/ + return frameworkRegex.test(value) +} From 0c9739419fe4db7956e30e74816b4aed8c99408f Mon Sep 17 00:00:00 2001 From: weishanchao <18178209323@163.com> Date: Mon, 19 Aug 2024 10:33:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Ebuild=E3=80=81cre?= =?UTF-8?q?ate=E3=80=81info=E3=80=81inspect=E3=80=81update=E3=80=81init=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=94=A8=E4=BE=8B=E5=92=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/__tests__/build-config.spec.ts | 46 +++- .../src/__tests__/cli-build-command.spec.ts | 203 ++++++++++++++++++ .../src/__tests__/cli-create-command.spec.ts | 87 ++++++++ .../taro-cli/src/__tests__/cli-create.spec.ts | 44 ++++ .../taro-cli/src/__tests__/cli-help.spec.ts | 42 ++++ .../src/__tests__/cli-info-command.spec.ts | 64 ++++++ .../taro-cli/src/__tests__/cli-init.spec.ts | 102 +++++++++ .../src/__tests__/cli-inspect-command.spec.ts | 94 ++++++++ .../src/__tests__/cli-update-command.spec.ts | 64 ++++++ packages/taro-cli/src/__tests__/cli.spec.ts | 4 +- .../taro-cli/src/__tests__/config.spec.ts | 54 ++--- .../src/__tests__/doctor-recommand.spec.ts | 4 +- .../taro-cli/src/__tests__/doctor.spec.ts | 4 +- packages/taro-cli/src/__tests__/info.spec.ts | 6 +- .../taro-cli/src/__tests__/inspect.spec.ts | 22 +- .../taro-cli/src/__tests__/update.spec.ts | 26 +-- .../taro-cli/src/__tests__/utils/index.ts | 2 +- 17 files changed, 804 insertions(+), 64 deletions(-) create mode 100644 packages/taro-cli/src/__tests__/cli-build-command.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-create-command.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-create.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-help.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-info-command.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-init.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-inspect-command.spec.ts create mode 100644 packages/taro-cli/src/__tests__/cli-update-command.spec.ts diff --git a/packages/taro-cli/src/__tests__/build-config.spec.ts b/packages/taro-cli/src/__tests__/build-config.spec.ts index 9465bf5cea3e..4d0837cb18ad 100644 --- a/packages/taro-cli/src/__tests__/build-config.spec.ts +++ b/packages/taro-cli/src/__tests__/build-config.spec.ts @@ -1,6 +1,6 @@ import * as path from 'node:path' -import { emptyDirectory } from '@tarojs/helper' +import { chalk, emptyDirectory } from '@tarojs/helper' import { run } from './utils' @@ -39,6 +39,46 @@ describe('构建配置测试', () => { emptyDirectoryMocked.mockReset() }) + it("should exit because there isn't a Taro project", async () => { + const exitSpy = jest.spyOn(process, 'exit') as jest.SpyInstance + const logSpy = jest.spyOn(console, 'log') + + exitSpy.mockImplementation(() => { + throw new Error() + }) + logSpy.mockImplementation(() => {}) + + try { + await runBuild('') + } catch (error) {} // eslint-disable-line no-empty + + expect(exitSpy).toHaveBeenCalledWith(1) + expect(logSpy).toHaveBeenCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) + + exitSpy.mockRestore() + logSpy.mockRestore() + }) + + it('should Please enter the correct compilation type', async () => { + const exitSpy = jest.spyOn(process, 'exit') as jest.SpyInstance + const logSpy = jest.spyOn(console, 'log') + + exitSpy.mockImplementation(() => { + throw new Error() + }) + logSpy.mockImplementation(() => {}) + + try { + await runBuild(path.resolve(__dirname, 'fixtures/default')) + } catch (error) {} // eslint-disable-line no-empty + + expect(exitSpy).toHaveBeenCalledWith(0) + expect(logSpy).toHaveBeenCalledWith(chalk.red('请传入正确的编译类型!')) + + exitSpy.mockRestore() + logSpy.mockRestore() + }) + describe('小程序', () => { it(`项目 output.clean = clean: { keep: ['project.config.json'] } ==> 清空dist文件夹但保留指定文件`, async () => { const exitSpy = jest.spyOn(process, 'exit') as jest.SpyInstance @@ -60,7 +100,7 @@ describe('构建配置测试', () => { } catch (error) { // no handler } - expect(emptyDirectoryMocked).toBeCalledWith(OUTPUT_PATH, { excludes: ['project.config.json'] }) + expect(emptyDirectoryMocked).toHaveBeenCalledWith(OUTPUT_PATH, { excludes: ['project.config.json'] }) exitSpy.mockRestore() logSpy.mockRestore() @@ -89,7 +129,7 @@ describe('构建配置测试', () => { } catch (error) { // no handler } - expect(emptyDirectoryMocked).toBeCalledTimes(0) + expect(emptyDirectoryMocked).not.toHaveBeenCalled() exitSpy.mockRestore() logSpy.mockRestore() diff --git a/packages/taro-cli/src/__tests__/cli-build-command.spec.ts b/packages/taro-cli/src/__tests__/cli-build-command.spec.ts new file mode 100644 index 000000000000..51cfbfae32bd --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-build-command.spec.ts @@ -0,0 +1,203 @@ +import { Kernel } from '@tarojs/service' + +import CLI from '../cli' + +jest.mock('@tarojs/helper', () => ({ + __esModule: true, + ...jest.requireActual('@tarojs/helper'), +})) +jest.mock('@tarojs/service') +const MockedKernel = (Kernel as unknown) as jest.MockedClass + +function setProcessArgv (cmd: string) { + // @ts-ignore + process.argv = [null, ...cmd.split(' ')] +} + +// Common expectation setup +const expectCommonInvocation = (options: Record, additionalArgs: Record, name?: string) => { + const ins = MockedKernel.mock.instances[0] + expect(ins.run).toHaveBeenCalledWith({ + name: 'build', + opts: { + _: ['build', ...(name ? [name] : [])], + options: { + args: { + _: ['build', ...(name ? [name] : [])], + build: true, + check: true, + h: false, + help: false, + v: false, + version: false, + type: 'weapp', + 'disable-global-config': false, + 'inject-global-style': true, + ...additionalArgs + }, + assetsDest: undefined, + blended: false, + bundleOutput: undefined, + deviceType: undefined, + env: undefined, + isBuildNativeComp: false, + isWatch: false, + newBlended: false, + noCheck: false, + noInjectGlobalStyle: false, + platform: 'weapp', + plugin: undefined, + port: undefined, + publicPath: undefined, + qr: false, + resetCache: false, + sourceMapUrl: undefined, + sourcemapOutput: undefined, + sourcemapSourcesRoot: undefined, + withoutBuild: false, + ...options + }, + isHelp: false, + }, + }) +} + +const taroBuildScenarios = [ + { + cmd: 'taro build --type weapp', + options: {}, + additionalArgs: {} + }, + { + cmd: 'taro build --type weapp --watch', + options: { isWatch: true }, + additionalArgs: { watch: true }, + }, + { + cmd: 'taro build --type weapp --env production', + options: { env: 'production' }, + additionalArgs: { env: 'production' } + }, + { + cmd: 'taro build --type weapp --blended', + options: { blended: true }, + additionalArgs: { blended: true } + }, + { + cmd: 'taro build --type weapp --no-build', + options: { withoutBuild: true }, + additionalArgs: { build: false } + }, + { + cmd: 'taro build --type weapp --new-blended', + options: { newBlended: true }, + additionalArgs: { 'new-blended': true } + }, + { + cmd: 'taro build --type weapp -p 80', + options: { port: 80 }, + additionalArgs: { port: 80, p: 80 } + }, + { + cmd: 'taro build --type weapp --no-check', + options: { noCheck: true }, + additionalArgs: { check: false } + }, + { + cmd: 'taro build --type weapp --mode prepare --env-prefix TARO_APP_', + options: {}, + additionalArgs: { mode: 'prepare', envPrefix: 'TARO_APP_', 'env-prefix': 'TARO_APP_' }, + }, + { + cmd: 'taro build --plugin weapp', + options: { platform: 'plugin', plugin: 'weapp' }, + additionalArgs: { type: undefined, plugin: 'weapp' }, + }, + { + cmd: 'taro build --plugin weapp --watch', + options: { platform: 'plugin', plugin: 'weapp', isWatch: true }, + additionalArgs: { type: undefined, plugin: 'weapp', watch: true }, + }, + { + cmd: 'taro build native-components --type weapp', + options: { isBuildNativeComp: true }, + additionalArgs: {}, + _name: 'native-components' + }, + { + cmd: 'taro build --type rn --platform ios', + options: { platform: 'rn', deviceType: 'ios' }, + additionalArgs: { type: 'rn', platform: 'ios' }, + }, + { + cmd: 'taro build --type rn --reset-cache', + options: { platform: 'rn', resetCache: true }, + additionalArgs: { type: 'rn', 'reset-cache': true, resetCache: true }, + }, + { + cmd: 'taro build --type rn --public-path', + options: { platform: 'rn', publicPath: true }, + additionalArgs: { type: 'rn', 'public-path': true, publicPath: true }, + }, + { + cmd: 'taro build --type rn --bundle-output', + options: { platform: 'rn', bundleOutput: true }, + additionalArgs: { type: 'rn', 'bundle-output': true, bundleOutput: true }, + }, + { + cmd: 'taro build --type rn --sourcemap-output', + options: { platform: 'rn', sourcemapOutput: true }, + additionalArgs: { type: 'rn', 'sourcemap-output': true, sourcemapOutput: true }, + }, + { + cmd: 'taro build --type rn --sourcemap-use-absolute-path', + options: { platform: 'rn', sourceMapUrl: true }, + additionalArgs: { type: 'rn', 'sourcemap-use-absolute-path': true, sourceMapUrl: true }, + }, + { + cmd: 'taro build --type rn --sourcemap-sources-root', + options: { platform: 'rn', sourcemapSourcesRoot: true }, + additionalArgs: { type: 'rn', 'sourcemap-sources-root': true, sourcemapSourcesRoot: true }, + }, + { + cmd: 'taro build --type rn --assets-dest', + options: { platform: 'rn', assetsDest: true }, + additionalArgs: { type: 'rn', 'assets-dest': true, assetsDest: true }, + }, + { + cmd: 'taro build --type rn --qr', + options: { platform: 'rn', qr: true }, + additionalArgs: { type: 'rn', qr: true }, + }, + { + cmd: 'taro build --type h5 --no-inject-global-style', + options: { platform: 'h5', noInjectGlobalStyle: true }, + additionalArgs: { type: 'h5', 'inject-global-style': false }, + } +] + +describe('create command', () => { + let cli + const appPath = '/' + + beforeAll(() => { + cli = new CLI(appPath) + }) + + beforeEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + afterEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + + it.each(taroBuildScenarios)(`should build the project for $cmd scenario`, async ({ cmd, options, additionalArgs, _name = undefined }) => { + setProcessArgv(cmd) + await cli.run() + expectCommonInvocation(options, additionalArgs, _name) + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-create-command.spec.ts b/packages/taro-cli/src/__tests__/cli-create-command.spec.ts new file mode 100644 index 000000000000..9e4d44be1051 --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-create-command.spec.ts @@ -0,0 +1,87 @@ +import { Kernel } from '@tarojs/service' + +import CLI from '../cli' + +jest.mock('@tarojs/helper', () => ({ + __esModule: true, + ...jest.requireActual('@tarojs/helper'), +})) +jest.mock('@tarojs/service') +const MockedKernel = (Kernel as unknown) as jest.MockedClass + +function setProcessArgv(cmd: string) { + // @ts-ignore + process.argv = [null, ...cmd.split(' ')] +} + +// Common expectation setup +const expectCommonInvocation = (options?: Record, name?: string) => { + const ins = MockedKernel.mock.instances[0] + expect(ins.run).toHaveBeenCalledWith({ + name: 'create', + opts: { + _: ['create', ...(name ? [name] : [])], + options: { + build: true, + check: true, + 'inject-global-style': true, + type: undefined, + ...options + }, + isHelp: false, + }, + }) +} + +describe('create command', () => { + let cli + const appPath = '/' + + beforeAll(() => { + cli = new CLI(appPath) + }) + + beforeEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + afterEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + it('creates a default project', async () => { + setProcessArgv(`taro create page`) + await cli.run() + expectCommonInvocation({}, 'page') + }) + + it.each([ + { + cmd: '--name page', + options: { name: 'page' } + }, + { + cmd: '--name page --description=desc', + options: { name: 'page', description: 'desc' } + }, + { + cmd: '--name page --type=plugin-command', + options: { name: 'page', type: 'plugin-command' } + }, + { + cmd: '--name page --dir src', + options: { name: 'page', dir: 'src' } + }, + { + cmd: '--name page --subpkg src', + options: { name: 'page', subpkg: 'src' } + }, + ])('creates a project with options: $cmd', async ({ cmd, options }) => { + setProcessArgv(`taro create ${cmd}`) + + await cli.run() + expectCommonInvocation(options) + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-create.spec.ts b/packages/taro-cli/src/__tests__/cli-create.spec.ts new file mode 100644 index 000000000000..824765b9e10b --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-create.spec.ts @@ -0,0 +1,44 @@ +import { chalk } from '@tarojs/helper' + +import { run } from './utils' + +jest.mock('@tarojs/helper', () => { + const helper = jest.requireActual('@tarojs/helper') + return { + __esModule: true, + ...helper + } +}) + +const runConfig = run('create', ['commands/create']) + +describe('create', () => { + const appPath = '/' + const pluginArr = ['plugin-command', 'plugin-build', 'plugin-template'] + + it('should create project', async () => { + const logSpy = jest.spyOn(console, 'log') + logSpy.mockImplementation(() => {}) + await runConfig(appPath, { + options: { + page: 'test', + } + }) + expect(logSpy).toHaveBeenCalledWith(chalk.red('请输入需要创建的页面名称')) + logSpy.mockRestore() + }) + + describe.each(pluginArr)('should display help for', (item) => { + it(`should create project ${item}`, async () => { + const logSpy = jest.spyOn(console, 'log') + logSpy.mockImplementation(() => {}) + await runConfig(appPath, { + options: { + type: item + } + }) + expect(logSpy).toHaveBeenCalledWith(chalk.red('请输入需要创建的插件名称')) + logSpy.mockRestore() + }) + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-help.spec.ts b/packages/taro-cli/src/__tests__/cli-help.spec.ts new file mode 100644 index 000000000000..05d2822f3392 --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-help.spec.ts @@ -0,0 +1,42 @@ +import { chalk } from '@tarojs/helper' + +import { run } from './utils' + +const runHelp = run('help', ['commands/help']) + +describe('help', () => { + const appPath = '/' + const cmdArr = ['init', 'config', 'create', 'build', 'update', 'info', 'doctor', 'inspect'] + + let logSpy + + beforeEach(() => { + logSpy = jest.spyOn(console, 'log') + }) + + afterEach(() => { + logSpy.mockRestore() + }) + + it('should enter taro help [cmd]', async () => { + logSpy.mockImplementation(() => {}) + await runHelp(appPath) + expect(logSpy).toHaveBeenCalledWith(chalk.yellow('用法:taro help [cmd],cmd 不存在!请输入需要查看帮助的命令名称。')) + logSpy.mockRestore() + }) + + describe.each(cmdArr)('should display help for', (cmd) => { + it(`should taro help ${cmd}`, async () => { + logSpy.mockImplementation(() => {}) + + await runHelp(appPath, { args: [cmd] }) + + expect(logSpy).toHaveBeenNthCalledWith(1, `Usage: taro ${cmd} [options]`) + expect(logSpy).toHaveBeenNthCalledWith(2) + expect(logSpy).toHaveBeenNthCalledWith(3, 'Options:') + expect(logSpy).toHaveBeenNthCalledWith(4, ' -h, --help output usage information') + + logSpy.mockRestore() + }) + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-info-command.spec.ts b/packages/taro-cli/src/__tests__/cli-info-command.spec.ts new file mode 100644 index 000000000000..6d727f4dd4cf --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-info-command.spec.ts @@ -0,0 +1,64 @@ +import { Kernel } from '@tarojs/service' + +import CLI from '../cli' + +jest.mock('@tarojs/helper', () => ({ + __esModule: true, + ...jest.requireActual('@tarojs/helper'), +})) +jest.mock('@tarojs/service') +const MockedKernel = (Kernel as unknown) as jest.MockedClass + +function setProcessArgv(cmd: string) { + // @ts-ignore + process.argv = [null, ...cmd.split(' ')] +} + +// Common expectation setup +const expectCommonInvocation = (name?: string) => { + const ins = MockedKernel.mock.instances[0] + expect(ins.run).toHaveBeenCalledWith({ + name: 'info', + opts: { + _: ['info', ...(name ? [name] : [])], + options: { + build: true, + check: true, + 'inject-global-style': true, + type: undefined, + }, + isHelp: false, + }, + }) +} + +describe('create command', () => { + let cli + const appPath = '/' + + beforeAll(() => { + cli = new CLI(appPath) + }) + + beforeEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + afterEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + it('should set info', async () => { + setProcessArgv(`taro info`) + await cli.run() + expectCommonInvocation() + }) + + it('should set info rn', async () => { + setProcessArgv(`taro info rn`) + await cli.run() + expectCommonInvocation('rn') + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-init.spec.ts b/packages/taro-cli/src/__tests__/cli-init.spec.ts new file mode 100644 index 000000000000..da15321d8e2c --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-init.spec.ts @@ -0,0 +1,102 @@ +import { Kernel } from '@tarojs/service' + +import CLI from '../cli' + +jest.mock('@tarojs/service') +const MockedKernel = (Kernel as unknown) as jest.MockedClass +const APP_PATH = '/a/b/c' +const projectName = 'test' + +function setProcessArgv(cmd: string) { + // @ts-ignore + process.argv = [null, ...cmd.split(' ')] +} + +function expectKernelRunCalledWith(options, name?: string) { + const ins = MockedKernel.mock.instances[0] + expect(ins.run).toHaveBeenCalledWith({ + name: 'init', + opts: { + _: ['init', ...(name ? [name] : [])], + options: { + appPath: APP_PATH, + projectName: undefined, + description: undefined, + framework: undefined, + typescript: undefined, + npm: undefined, + templateSource: undefined, + clone: false, + compiler: undefined, + template: undefined, + css: undefined, + autoInstall: undefined, + ...options + }, + isHelp: false + } + }) +} + +describe('CLI init', () => { + let cli: CLI + + beforeAll(() => { + cli = new CLI(APP_PATH) + }) + + beforeEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + afterEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + it('should set init', async () => { + setProcessArgv(`taro init ${projectName}`) + await cli.run() + expectKernelRunCalledWith({ projectName }, projectName) + }) + + it.each([ + ['name', `--name ${projectName}`, { projectName }], + ['description', `--description test`, { description: 'test' }], + ['typescript', `--typescript`, { typescript: true }], + ['npm', `--npm npm`, { npm: 'npm' }], + ['template-source', `--template-source default`, { templateSource: 'default' }], + ['clone', `--clone`, { clone: true }], + ['template', `--template default`, { template: 'default' }], + ['css', `--css sass`, { css: 'sass' }], + ['autoInstall', `--autoInstall`, { autoInstall: true }], + ['compiler', `--compiler vite`, { compiler: 'vite' }], + ['framework', `--framework react`, { framework: 'react' }] + ])('should set %s', async (_, cmd, options) => { + setProcessArgv(`taro init ${cmd}`) + await cli.run() + expectKernelRunCalledWith(options) + }) + + it('should set multiple options', async () => { + const options = { + projectName, + templateSource: 'default', + template: 'redux', + description: 'test', + typescript: true, + npm: 'pnpm', + clone: true, + css: 'sass', + autoInstall: true, + compiler: 'vite', + framework: 'react' + } + setProcessArgv( + `taro init --name test --description test --typescript --npm pnpm --template-source default --clone --template redux --css sass --autoInstall --compiler vite --framework react` + ) + await cli.run() + expectKernelRunCalledWith(options) + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-inspect-command.spec.ts b/packages/taro-cli/src/__tests__/cli-inspect-command.spec.ts new file mode 100644 index 000000000000..873ef1719a8e --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-inspect-command.spec.ts @@ -0,0 +1,94 @@ +import { Kernel } from '@tarojs/service' + +import CLI from '../cli' + +jest.mock('@tarojs/helper', () => ({ + __esModule: true, + ...jest.requireActual('@tarojs/helper'), +})) +jest.mock('@tarojs/service') +const MockedKernel = (Kernel as unknown) as jest.MockedClass + +function setProcessArgv(cmd: string) { + // @ts-ignore + process.argv = [null, ...cmd.split(' ')] +} + +// Common expectation setup +const expectCommonInvocation = (options?: Record, name?: string) => { + const ins = MockedKernel.mock.instances[0] + expect(ins.run).toHaveBeenCalledWith({ + name: 'inspect', + opts: { + _: ['inspect', ...(name ? [name] : [])], + options: { + build: true, + check: true, + 'inject-global-style': true, + type: 'weapp', + ...options + }, + isHelp: false, + }, + }) +} + +describe('create command', () => { + let cli + const appPath = '/' + + beforeAll(() => { + cli = new CLI(appPath) + }) + + beforeEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + afterEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + it.each([ + ['weapp'], + ['swan'], + ['alipay'], + ['tt'], + ['h5'], + ['quickapp'], + ['rn'], + ['qq'], + ['jd'], + ])('should inspect the project for %s platform', async (item) => { + setProcessArgv(`taro inspect --type ${item}`) + await cli.run() + expectCommonInvocation({ type: item }) + }) + + it.each([ + { + cmd: 'taro inspect --type weapp', + options: {} + }, + { + cmd: 'taro inspect --type weapp --output inspect.config.js', + options: { output: 'inspect.config.js' } + }, + { + cmd: 'taro inspect --type weapp plugins', + options: {}, + name: 'plugins' + }, + { + cmd: 'taro inspect --type weapp module.rules.0', + options: {}, + name: 'module.rules.0' + } + ])('should inspect the project for $cmd', async ({ cmd, options, name = undefined }) => { + setProcessArgv(`${cmd}`) + await cli.run() + expectCommonInvocation(options, name) + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli-update-command.spec.ts b/packages/taro-cli/src/__tests__/cli-update-command.spec.ts new file mode 100644 index 000000000000..3e9342636db3 --- /dev/null +++ b/packages/taro-cli/src/__tests__/cli-update-command.spec.ts @@ -0,0 +1,64 @@ +import { Kernel } from '@tarojs/service' + +import CLI from '../cli' + +jest.mock('@tarojs/helper', () => ({ + __esModule: true, + ...jest.requireActual('@tarojs/helper'), +})) +jest.mock('@tarojs/service') +const MockedKernel = (Kernel as unknown) as jest.MockedClass + +function setProcessArgv(cmd: string) { + // @ts-ignore + process.argv = [null, ...cmd.split(' ')] +} + +// Common expectation setup +const expectCommonInvocation = (name: string) => { + const ins = MockedKernel.mock.instances[0] + expect(ins.run).toHaveBeenCalledWith({ + name: 'update', + opts: { + _: ['update', name], + options: { + build: true, + check: true, + 'inject-global-style': true, + type: undefined, + }, + isHelp: false, + }, + }) +} + +describe('create command', () => { + let cli + const appPath = '/' + + beforeAll(() => { + cli = new CLI(appPath) + }) + + beforeEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + afterEach(() => { + MockedKernel.mockClear() + process.argv = [] + }) + + it('updates the Taro CLI to the latest version', async () => { + setProcessArgv(`taro update self`) + await cli.run() + expectCommonInvocation('self') + }) + + it('updates the project dependencies to the latest version', async () => { + setProcessArgv(`taro update project`) + await cli.run() + expectCommonInvocation('project') + }) +}) diff --git a/packages/taro-cli/src/__tests__/cli.spec.ts b/packages/taro-cli/src/__tests__/cli.spec.ts index e32762ad0b9b..71ba84e4c053 100644 --- a/packages/taro-cli/src/__tests__/cli.spec.ts +++ b/packages/taro-cli/src/__tests__/cli.spec.ts @@ -214,7 +214,7 @@ describe('inspect', () => { setProcessArgv('taro -h') await cli.run() - expect(spy).toBeCalledTimes(16) + expect(spy).toHaveBeenCalledTimes(16) spy.mockRestore() }) @@ -225,7 +225,7 @@ describe('inspect', () => { setProcessArgv('taro -v') await cli.run() - expect(spy).toBeCalledWith(getPkgVersion()) + expect(spy).toHaveBeenCalledWith(getPkgVersion()) spy.mockRestore() }) diff --git a/packages/taro-cli/src/__tests__/config.spec.ts b/packages/taro-cli/src/__tests__/config.spec.ts index 66dc7c717d83..9bc80324f7b9 100644 --- a/packages/taro-cli/src/__tests__/config.spec.ts +++ b/packages/taro-cli/src/__tests__/config.spec.ts @@ -61,7 +61,7 @@ describe('config', () => { await runConfig(appPath) - expect(logSpy).toBeCalledWith('找不到用户根目录') + expect(logSpy).toHaveBeenCalledWith('找不到用户根目录') logSpy.mockRestore() }) @@ -71,7 +71,7 @@ describe('config', () => { await runConfig(appPath, { args: ['get'] }) - expect(logSpy).toBeCalledWith('Usage: taro config get ') + expect(logSpy).toHaveBeenCalledWith('Usage: taro config get ') logSpy.mockRestore() }) @@ -88,9 +88,9 @@ describe('config', () => { await runConfig(appPath, { args: ['get', key] }) - expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`) - expect(logSpy).nthCalledWith(2) - expect(logSpy).nthCalledWith(3, `key: ${key}, value: ${value}`) + expect(logSpy).toHaveBeenNthCalledWith(1, `Config path: ${configPath}`) + expect(logSpy).toHaveBeenNthCalledWith(2) + expect(logSpy).toHaveBeenNthCalledWith(3, `key: ${key}, value: ${value}`) logSpy.mockRestore() readJSONSyncMocked.mockReset() @@ -102,7 +102,7 @@ describe('config', () => { await runConfig(appPath, { args: ['set', 'k'] }) - expect(logSpy).toBeCalledWith('Usage: taro config set ') + expect(logSpy).toHaveBeenCalledWith('Usage: taro config set ') logSpy.mockRestore() }) @@ -117,13 +117,13 @@ describe('config', () => { await runConfig(appPath, { args: ['set', key, value] }) - expect(writeJSONSyncMocked).toBeCalledWith(configPath, { + expect(writeJSONSyncMocked).toHaveBeenCalledWith(configPath, { a: 1, [key]: value }) - expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`) - expect(logSpy).nthCalledWith(2) - expect(logSpy).nthCalledWith(3, `set key: ${key}, value: ${value}`) + expect(logSpy).toHaveBeenNthCalledWith(1, `Config path: ${configPath}`) + expect(logSpy).toHaveBeenNthCalledWith(2) + expect(logSpy).toHaveBeenNthCalledWith(3, `set key: ${key}, value: ${value}`) logSpy.mockRestore() readJSONSyncMocked.mockReset() @@ -141,9 +141,9 @@ describe('config', () => { await runConfig(appPath, { args: ['set', key, value] }) - expect(ensureFileSyncMocked).toBeCalledWith(configPath) - expect(writeJSONSyncMocked).toBeCalledWith(configPath, { [key]: value }) - expect(logSpy).toBeCalledWith(`set key: ${key}, value: ${value}`) + expect(ensureFileSyncMocked).toHaveBeenCalledWith(configPath) + expect(writeJSONSyncMocked).toHaveBeenCalledWith(configPath, { [key]: value }) + expect(logSpy).toHaveBeenCalledWith(`set key: ${key}, value: ${value}`) logSpy.mockRestore() existsSyncMocked.mockReset() @@ -157,7 +157,7 @@ describe('config', () => { await runConfig(appPath, { args: ['delete'] }) - expect(logSpy).toBeCalledWith('Usage: taro config delete ') + expect(logSpy).toHaveBeenCalledWith('Usage: taro config delete ') logSpy.mockRestore() }) @@ -174,10 +174,10 @@ describe('config', () => { await runConfig(appPath, { args: ['delete', key] }) - expect(writeJSONSyncMocked).toBeCalledWith(configPath, { a: 1 }) - expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`) - expect(logSpy).nthCalledWith(2) - expect(logSpy).nthCalledWith(3, `deleted: ${key}`) + expect(writeJSONSyncMocked).toHaveBeenCalledWith(configPath, { a: 1 }) + expect(logSpy).toHaveBeenNthCalledWith(1, `Config path: ${configPath}`) + expect(logSpy).toHaveBeenNthCalledWith(2) + expect(logSpy).toHaveBeenNthCalledWith(3, `deleted: ${key}`) logSpy.mockRestore() readJSONSyncMocked.mockReset() @@ -195,11 +195,11 @@ describe('config', () => { await runConfig(appPath, { args: ['list'] }) - expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`) - expect(logSpy).nthCalledWith(2) - expect(logSpy).nthCalledWith(3, 'Config info:') - expect(logSpy).nthCalledWith(4, 'a=1') - expect(logSpy).nthCalledWith(5, 'b=2') + expect(logSpy).toHaveBeenNthCalledWith(1, `Config path: ${configPath}`) + expect(logSpy).toHaveBeenNthCalledWith(2) + expect(logSpy).toHaveBeenNthCalledWith(3, 'Config info:') + expect(logSpy).toHaveBeenNthCalledWith(4, 'a=1') + expect(logSpy).toHaveBeenNthCalledWith(5, 'b=2') logSpy.mockRestore() readJSONSyncMocked.mockReset() @@ -221,10 +221,10 @@ describe('config', () => { } }) - expect(logSpy).nthCalledWith(1, `Config path: ${configPath}`) - expect(logSpy).nthCalledWith(2) - expect(logSpy).nthCalledWith(3, 'Config info:') - expect(logSpy).nthCalledWith(4, JSON.stringify({ a: 1, b: 2 }, null, 2)) + expect(logSpy).toHaveBeenNthCalledWith(1, `Config path: ${configPath}`) + expect(logSpy).toHaveBeenNthCalledWith(2) + expect(logSpy).toHaveBeenNthCalledWith(3, 'Config info:') + expect(logSpy).toHaveBeenNthCalledWith(4, JSON.stringify({ a: 1, b: 2 }, null, 2)) logSpy.mockRestore() readJSONSyncMocked.mockReset() diff --git a/packages/taro-cli/src/__tests__/doctor-recommand.spec.ts b/packages/taro-cli/src/__tests__/doctor-recommand.spec.ts index 4529d9ea67e5..b1648b59f5f2 100644 --- a/packages/taro-cli/src/__tests__/doctor-recommand.spec.ts +++ b/packages/taro-cli/src/__tests__/doctor-recommand.spec.ts @@ -46,9 +46,9 @@ describe('recommand validator of doctor', () => { await validator({ appPath: MOCK_APP_PATH }) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(1) + expect(exitSpy).toHaveBeenCalledWith(1) const PROJECT_PACKAGE_PATH = path.join(MOCK_APP_PATH, 'package.json') - expect(logSpy).toBeCalledWith(chalk.red(`找不到${PROJECT_PACKAGE_PATH},请确定当前目录是Taro项目根目录!`)) + expect(logSpy).toHaveBeenCalledWith(chalk.red(`找不到${PROJECT_PACKAGE_PATH},请确定当前目录是Taro项目根目录!`)) exitSpy.mockRestore() logSpy.mockRestore() diff --git a/packages/taro-cli/src/__tests__/doctor.spec.ts b/packages/taro-cli/src/__tests__/doctor.spec.ts index 027fc48b58fb..7a2afd84c3c8 100644 --- a/packages/taro-cli/src/__tests__/doctor.spec.ts +++ b/packages/taro-cli/src/__tests__/doctor.spec.ts @@ -68,8 +68,8 @@ describe('doctor', () => { await runDoctor('', { options: { disableGlobalConfig: true } }) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(1) - expect(logSpy).toBeCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) + expect(exitSpy).toHaveBeenCalledWith(1) + expect(logSpy).toHaveBeenCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) exitSpy.mockRestore() logSpy.mockRestore() diff --git a/packages/taro-cli/src/__tests__/info.spec.ts b/packages/taro-cli/src/__tests__/info.spec.ts index 1242df5d8187..550bf556cad6 100644 --- a/packages/taro-cli/src/__tests__/info.spec.ts +++ b/packages/taro-cli/src/__tests__/info.spec.ts @@ -32,8 +32,8 @@ describe('info', () => { await runInfo('') } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(1) - expect(logSpy).toBeCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) + expect(exitSpy).toHaveBeenCalledWith(1) + expect(logSpy).toHaveBeenCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) exitSpy.mockRestore() logSpy.mockRestore() @@ -46,7 +46,7 @@ describe('info', () => { const appPath = path.resolve(__dirname, 'fixtures/default') await runInfo(appPath) - expect(logSpy).toBeCalledTimes(1) + expect(logSpy).toHaveBeenCalledTimes(1) const res = logSpy.mock.calls[0][0] const title = `Taro CLI ${getPkgVersion()} environment info` expect(res.hasOwnProperty(title)).toBeTruthy() diff --git a/packages/taro-cli/src/__tests__/inspect.spec.ts b/packages/taro-cli/src/__tests__/inspect.spec.ts index 932ea3a9989d..cd3e61032d21 100644 --- a/packages/taro-cli/src/__tests__/inspect.spec.ts +++ b/packages/taro-cli/src/__tests__/inspect.spec.ts @@ -50,8 +50,8 @@ describe('inspect', () => { await runInspect('') } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(1) - expect(logSpy).toBeCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) + expect(exitSpy).toHaveBeenCalledWith(1) + expect(logSpy).toHaveBeenCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!')) exitSpy.mockRestore() logSpy.mockRestore() @@ -70,8 +70,8 @@ describe('inspect', () => { await runInspect(path.resolve(__dirname, 'fixtures/default')) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(0) - expect(logSpy).toBeCalledWith(chalk.red('请传入正确的编译类型!')) + expect(exitSpy).toHaveBeenCalledWith(0) + expect(logSpy).toHaveBeenCalledWith(chalk.red('请传入正确的编译类型!')) exitSpy.mockRestore() logSpy.mockRestore() @@ -95,8 +95,8 @@ describe('inspect', () => { }) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(0) - expect(logSpy).toBeCalledTimes(1) + expect(exitSpy).toHaveBeenCalledWith(0) + expect(logSpy).toHaveBeenCalledTimes(1) exitSpy.mockRestore() logSpy.mockRestore() @@ -123,9 +123,9 @@ describe('inspect', () => { }) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(0) - expect(logSpy).toBeCalledTimes(1) - expect(logSpy).toBeCalledWith('\'main:h5\'') + expect(exitSpy).toHaveBeenCalledWith(0) + expect(logSpy).toHaveBeenCalledTimes(1) + expect(logSpy).toHaveBeenCalledWith('\'main:h5\'') exitSpy.mockRestore() logSpy.mockRestore() @@ -152,8 +152,8 @@ describe('inspect', () => { }) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(0) - expect(writeFileSync).toBeCalledWith(outputPath, '\'browser\'') + expect(exitSpy).toHaveBeenCalledWith(0) + expect(writeFileSync).toHaveBeenCalledWith(outputPath, '\'browser\'') exitSpy.mockRestore() }) diff --git a/packages/taro-cli/src/__tests__/update.spec.ts b/packages/taro-cli/src/__tests__/update.spec.ts index 93a11603a610..10db48ebc4db 100644 --- a/packages/taro-cli/src/__tests__/update.spec.ts +++ b/packages/taro-cli/src/__tests__/update.spec.ts @@ -134,7 +134,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(spy).toBeCalledTimes(3) + expect(spy).toHaveBeenCalledTimes(3) spy.mockRestore() }) @@ -146,7 +146,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith(`npm i -g @tarojs/cli@${lastestVersion}`) + expect(execMocked).toHaveBeenCalledWith(`npm i -g @tarojs/cli@${lastestVersion}`) }) it('should update self using yarn', async () => { @@ -158,7 +158,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith(`yarn global add @tarojs/cli@${lastestVersion}`) + expect(execMocked).toHaveBeenCalledWith(`yarn global add @tarojs/cli@${lastestVersion}`) }) it('should update self using pnpm', async () => { @@ -170,7 +170,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith(`pnpm add -g @tarojs/cli@${lastestVersion}`) + expect(execMocked).toHaveBeenCalledWith(`pnpm add -g @tarojs/cli@${lastestVersion}`) }) it('should update self using cnpm', async () => { @@ -182,7 +182,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith(`cnpm i -g @tarojs/cli@${lastestVersion}`) + expect(execMocked).toHaveBeenCalledWith(`cnpm i -g @tarojs/cli@${lastestVersion}`) }) it('should update self to specific version', async () => { @@ -194,7 +194,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith(`npm i -g @tarojs/cli@${version}`) + expect(execMocked).toHaveBeenCalledWith(`npm i -g @tarojs/cli@${version}`) }) it('should throw when there isn\'t a Taro project', async () => { @@ -214,8 +214,8 @@ describe('update', () => { } }) } catch (error) {} // eslint-disable-line no-empty - expect(exitSpy).toBeCalledWith(1) - expect(chalkMocked).toBeCalledWith(`找不到项目配置文件 ${PROJECT_CONFIG},请确定当前目录是 Taro 项目根目录!`) + expect(exitSpy).toHaveBeenCalledWith(1) + expect(chalkMocked).toHaveBeenCalledWith(`找不到项目配置文件 ${PROJECT_CONFIG},请确定当前目录是 Taro 项目根目录!`) exitSpy.mockRestore() logSpy.mockRestore() }) @@ -237,7 +237,7 @@ describe('update', () => { }) expect(writeJson.mock.calls[0][0]).toEqual(pkgPath) expect(writeJson.mock.calls[0][1]).toEqual(packageMap) - expect(execMocked).toBeCalledWith('npm install') + expect(execMocked).toHaveBeenCalledWith('npm install') logSpy.mockRestore() }) @@ -260,7 +260,7 @@ describe('update', () => { }) expect(writeJson.mock.calls[0][0]).toEqual(pkgPath) expect(writeJson.mock.calls[0][1]).toEqual(packageMap) - expect(execMocked).toBeCalledWith('npm install') + expect(execMocked).toHaveBeenCalledWith('npm install') logSpy.mockRestore() }) @@ -279,7 +279,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith('yarn install') + expect(execMocked).toHaveBeenCalledWith('yarn install') logSpy.mockRestore() }) @@ -298,7 +298,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith('pnpm install') + expect(execMocked).toHaveBeenCalledWith('pnpm install') logSpy.mockRestore() }) @@ -317,7 +317,7 @@ describe('update', () => { disableGlobalConfig: true } }) - expect(execMocked).toBeCalledWith('cnpm install') + expect(execMocked).toHaveBeenCalledWith('cnpm install') logSpy.mockRestore() }) diff --git a/packages/taro-cli/src/__tests__/utils/index.ts b/packages/taro-cli/src/__tests__/utils/index.ts index 8616ef897425..02a8bcf0ae38 100644 --- a/packages/taro-cli/src/__tests__/utils/index.ts +++ b/packages/taro-cli/src/__tests__/utils/index.ts @@ -36,7 +36,7 @@ export function run (name: string, presets: string[] = []): IRun { kernel.optsPlugins ||= [] const type = options.type - if (typeof type === 'string' && !presets.some(e => e.includes(type))) { + if (name !== 'create' && typeof type === 'string' && !presets.some(e => e.includes(type))) { kernel.optsPlugins.push(require.resolve(`@tarojs/plugin-platform-${options.type}`)) } From aad680b11d6a7932bc423ce133e31d69286b2001 Mon Sep 17 00:00:00 2001 From: weishanchao <18178209323@163.com> Date: Thu, 22 Aug 2024 17:15:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Etaro-vite-runner?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/babel.spec.ts.snap | 1726 + .../compiler-macros.spec.ts.snap | 1721 + .../__snapshots__/config.spec.ts.snap | 8805 +++++ .../__snapshots__/css-modules.spec.ts.snap | 3486 ++ .../__snapshots__/framework.spec.ts.snap | 4103 +++ .../__snapshots__/mini-platform.spec.ts.snap | 4705 +++ .../mini-split-chunks.spec.ts.snap | 3 + .../__snapshots__/parse-html.spec.ts.snap | 1684 + .../__snapshots__/prerender.spec.ts.snap | 9337 +++++ .../__tests__/__snapshots__/sass.spec.ts.snap | 8638 +++++ .../__snapshots__/skyline.spec.ts.snap | 2421 ++ .../__snapshots__/subpackages.spec.ts.snap | 1905 + .../__snapshots__/tabbar.spec.ts.snap | 5136 +++ .../__tests__/__snapshots__/ts.spec.ts.snap | 1737 + .../__snapshots__/wx-hybrid.spec.ts.snap | 1983 ++ .../taro-vite-runner/__tests__/babel.spec.ts | 27 + .../__tests__/bundled/globby/index.js | 8873 +++++ .../__tests__/fixtures/babel/babel.config.js | 12 + .../fixtures/babel/src/app.config.js | 11 + .../__tests__/fixtures/babel/src/app.css | 0 .../__tests__/fixtures/babel/src/app.js | 18 + .../__tests__/fixtures/babel/src/index.html | 19 + .../babel/src/pages/index/index.config.js | 3 + .../fixtures/babel/src/pages/index/index.css | 0 .../fixtures/babel/src/pages/index/index.jsx | 23 + .../fixtures/common-style/babel.config.js | 11 + .../fixtures/common-style/src/app.config.js | 12 + .../fixtures/common-style/src/app.js | 18 + .../fixtures/common-style/src/app.scss | 3 + .../src/components/title/index.config.js | 1 + .../src/components/title/index.jsx | 13 + .../src/components/title/index.scss | 3 + .../fixtures/common-style/src/index.html | 19 + .../src/pages/about/index.config.js | 3 + .../common-style/src/pages/about/index.jsx | 14 + .../src/pages/index/index.config.js | 3 + .../common-style/src/pages/index/index.jsx | 14 + .../fixtures/compiler-macros/babel.config.js | 12 + .../compiler-macros/src/app.config.js | 11 + .../fixtures/compiler-macros/src/app.css | 0 .../fixtures/compiler-macros/src/app.js | 18 + .../fixtures/compiler-macros/src/index.html | 19 + .../compiler-macros/src/pages/index/index.css | 0 .../compiler-macros/src/pages/index/index.jsx | 17 + .../__tests__/fixtures/config/babel.config.js | 11 + .../config/origin/alias/files/index/index.js | 5 + .../config/origin/alias/utils/index.js | 3 + .../fixtures/config/origin/app.config.js | 11 + .../__tests__/fixtures/config/origin/app.css | 0 .../__tests__/fixtures/config/origin/app.js | 18 + .../fixtures/config/origin/index.html | 19 + .../fixtures/config/origin/irrelevant.txt | 1 + .../config/origin/pages/index/index.config.js | 3 + .../config/origin/pages/index/index.css | 0 .../config/origin/pages/index/index.jsx | 18 + .../fixtures/config/origin/weapp/index.wxml | 1 + .../fixtures/css-modules/babel.config.js | 11 + .../fixtures/css-modules/src/app.config.js | 11 + .../fixtures/css-modules/src/app.css | 0 .../__tests__/fixtures/css-modules/src/app.js | 18 + .../fixtures/css-modules/src/index.global.css | 3 + .../fixtures/css-modules/src/index.html | 19 + .../src/pages/index/index.config.js | 3 + .../css-modules/src/pages/index/index.css | 3 + .../css-modules/src/pages/index/index.jsx | 23 + .../src/pages/index/index.module.css | 9 + .../fixtures/custom-tabbar/babel.config.js | 11 + .../fixtures/custom-tabbar/src/app.config.js | 30 + .../fixtures/custom-tabbar/src/app.css | 0 .../fixtures/custom-tabbar/src/app.js | 18 + .../fixtures/custom-tabbar/src/assets/nav.png | Bin 0 -> 1233 bytes .../custom-tabbar/src/assets/nav_red.png | Bin 0 -> 1659 bytes .../custom-tabbar/src/assets/view.png | Bin 0 -> 653 bytes .../custom-tabbar/src/assets/view_red.png | Bin 0 -> 1279 bytes .../src/custom-tab-bar/index.config.js | 2 + .../src/custom-tab-bar/index.css | 4 + .../src/custom-tab-bar/index.jsx | 25 + .../fixtures/custom-tabbar/src/index.html | 19 + .../src/pages/detail/index.config.js | 3 + .../custom-tabbar/src/pages/detail/index.jsx | 12 + .../src/pages/index/index.config.js | 3 + .../custom-tabbar/src/pages/index/index.jsx | 12 + .../mini-split-chunks/babel.config.js | 10 + .../mini-split-chunks/src/app.config.js | 26 + .../fixtures/mini-split-chunks/src/app.css | 4 + .../fixtures/mini-split-chunks/src/app.js | 18 + .../mini-split-chunks/src/css/sub-common.css | 3 + .../src/css/sub-common.module.css | 3 + .../mini-split-chunks/src/css/sub-vendors.css | 3 + .../src/css/sub-vendors.module.css | 3 + .../fixtures/mini-split-chunks/src/index.html | 19 + .../src/packageA/detail/index.config.js | 3 + .../src/packageA/detail/index.css | 4 + .../src/packageA/detail/index.jsx | 32 + .../src/packageA/my/index.config.js | 3 + .../src/packageA/my/index.jsx | 32 + .../src/packageB/list/index.config.js | 3 + .../src/packageB/list/index.jsx | 29 + .../src/pages/index/index.config.js | 3 + .../src/pages/index/index.jsx | 26 + .../src/utils/consoleLogMain.js | 3 + .../src/utils/consoleLogSubCommon.js | 3 + .../src/utils/consoleLogSubVendors.js | 3 + .../src/utils/testExcludeFunction.js | 3 + .../src/utils/testExcludeString.js | 3 + .../fixtures/parse-html/babel.config.js | 11 + .../fixtures/parse-html/src/app.config.js | 11 + .../__tests__/fixtures/parse-html/src/app.css | 0 .../__tests__/fixtures/parse-html/src/app.js | 18 + .../fixtures/parse-html/src/index.html | 19 + .../src/pages/index/index.config.js | 3 + .../parse-html/src/pages/index/index.css | 0 .../parse-html/src/pages/index/index.jsx | 152 + .../fixtures/prerender/babel.config.js | 11 + .../fixtures/prerender/src/app.config.js | 13 + .../__tests__/fixtures/prerender/src/app.css | 0 .../__tests__/fixtures/prerender/src/app.js | 18 + .../fixtures/prerender/src/index.html | 19 + .../prerender/src/others/detail/index.jsx | 65 + .../prerender/src/others/detail/region.js | 1618 + .../prerender/src/others/normal/index.jsx | 15 + .../prerender/src/pages/index/index.config.js | 3 + .../prerender/src/pages/index/index.css | 0 .../prerender/src/pages/index/index.jsx | 13 + .../__tests__/fixtures/prerender/vmMock.js | 113 + .../__tests__/fixtures/react/babel.config.js | 11 + .../fixtures/react/src/app.config.js | 11 + .../__tests__/fixtures/react/src/app.css | 0 .../__tests__/fixtures/react/src/app.js | 18 + .../__tests__/fixtures/react/src/index.html | 19 + .../react/src/pages/index/index.config.js | 3 + .../fixtures/react/src/pages/index/index.css | 0 .../fixtures/react/src/pages/index/index.jsx | 42 + .../__tests__/fixtures/sass/babel.config.js | 11 + .../fixtures/sass/input/app.config.js | 11 + .../__tests__/fixtures/sass/input/app.js | 10 + .../__tests__/fixtures/sass/input/index.html | 19 + .../sass/input/pages/index/index.config.js | 3 + .../fixtures/sass/input/pages/index/index.jsx | 13 + .../sass/input/pages/index/index.sass | 2 + .../__tests__/fixtures/sass/src/app.config.js | 11 + .../__tests__/fixtures/sass/src/app.js | 18 + .../__tests__/fixtures/sass/src/app.scss | 0 .../fixtures/sass/src/common/global.scss | 3 + .../__tests__/fixtures/sass/src/index.html | 19 + .../sass/src/pages/index/index.config.js | 3 + .../fixtures/sass/src/pages/index/index.jsx | 21 + .../fixtures/sass/src/pages/index/index.scss | 9 + .../fixtures/skyline/babel.config.js | 11 + .../fixtures/skyline/src/app.config.js | 17 + .../__tests__/fixtures/skyline/src/app.css | 0 .../__tests__/fixtures/skyline/src/app.js | 18 + .../__tests__/fixtures/skyline/src/index.html | 19 + .../skyline/src/pages/index/index.config.js | 7 + .../skyline/src/pages/index/index.css | 0 .../skyline/src/pages/index/index.jsx | 46 + .../fixtures/subpackages/babel.config.js | 11 + .../fixtures/subpackages/src/app.config.js | 20 + .../fixtures/subpackages/src/app.css | 0 .../__tests__/fixtures/subpackages/src/app.js | 18 + .../fixtures/subpackages/src/index.html | 19 + .../subpackages/src/packageA/common.js | 3 + .../src/packageA/detail/index.config.js | 3 + .../subpackages/src/packageA/detail/index.css | 4 + .../subpackages/src/packageA/detail/index.jsx | 18 + .../src/packageA/my/index.config.js | 3 + .../subpackages/src/packageA/my/index.jsx | 17 + .../src/pages/index/index.config.js | 3 + .../subpackages/src/pages/index/index.jsx | 18 + .../__tests__/fixtures/tabbar/babel.config.js | 11 + .../fixtures/tabbar/src/app.config.js | 30 + .../__tests__/fixtures/tabbar/src/app.js | 18 + .../__tests__/fixtures/tabbar/src/app.scss | 0 .../fixtures/tabbar/src/assets/nav.png | Bin 0 -> 1233 bytes .../fixtures/tabbar/src/assets/nav_red.png | Bin 0 -> 1659 bytes .../fixtures/tabbar/src/assets/view.png | Bin 0 -> 653 bytes .../fixtures/tabbar/src/assets/view_red.png | Bin 0 -> 1279 bytes .../__tests__/fixtures/tabbar/src/index.html | 19 + .../tabbar/src/pages/about/index.config.js | 3 + .../fixtures/tabbar/src/pages/about/index.jsx | 12 + .../tabbar/src/pages/index/index.config.js | 3 + .../fixtures/tabbar/src/pages/index/index.jsx | 12 + .../fixtures/typescript/babel.config.js | 11 + .../__tests__/fixtures/typescript/global.d.ts | 18 + .../fixtures/typescript/src/app.config.ts | 11 + .../fixtures/typescript/src/app.less | 0 .../__tests__/fixtures/typescript/src/app.ts | 18 + .../fixtures/typescript/src/index.html | 19 + .../src/pages/index/index.config.ts | 3 + .../typescript/src/pages/index/index.less | 9 + .../typescript/src/pages/index/index.tsx | 24 + .../fixtures/typescript/tsconfig.json | 26 + .../__tests__/fixtures/vue3/babel.config.js | 11 + .../__tests__/fixtures/vue3/src/app.config.js | 11 + .../__tests__/fixtures/vue3/src/app.css | 0 .../__tests__/fixtures/vue3/src/app.js | 9 + .../__tests__/fixtures/vue3/src/index.html | 19 + .../vue3/src/pages/index/index.config.js | 3 + .../fixtures/vue3/src/pages/index/index.css | 0 .../fixtures/vue3/src/pages/index/index.vue | 17 + .../fixtures/wx-hybrid/babel.config.js | 12 + .../fixtures/wx-hybrid/src/app.config.js | 12 + .../__tests__/fixtures/wx-hybrid/src/app.js | 22 + .../__tests__/fixtures/wx-hybrid/src/app.scss | 0 .../wx-hybrid/src/components/tab/tab.js | 45 + .../wx-hybrid/src/components/tab/tab.json | 4 + .../wx-hybrid/src/components/tab/tab.wxml | 3 + .../fixtures/wx-hybrid/src/index.html | 19 + .../wx-hybrid/src/pages/index/index.config.js | 6 + .../wx-hybrid/src/pages/index/index.js | 48 + .../wx-hybrid/src/pages/index/index.scss | 11 + .../wx-hybrid/src/pages/native/native.js | 31 + .../wx-hybrid/src/pages/native/native.json | 10 + .../wx-hybrid/src/pages/native/native.wxml | 4 + .../wx-hybrid/src/pages/native/native.wxss | 3 + .../fixtures/wx-hybrid/src/utils/util.js | 3 + .../taro-vite-runner/__tests__/mocks/deps.ts | 1 + .../taro-vite-runner/__tests__/mocks/nerv.ts | 3 + .../__tests__/mocks/react-refresh.js | 3 + .../taro-vite-runner/__tests__/mocks/react.ts | 3 + .../__tests__/mocks/taro-components.css | 0 .../__tests__/mocks/taro-components.ts | 13 + .../__tests__/mocks/taro-react.ts | 1 + .../__tests__/mocks/taro-router.ts | 2 + .../__tests__/mocks/taro-runtime.ts | 8 + .../__tests__/mocks/taro-shared.ts | 26 + .../taro-vite-runner/__tests__/mocks/taro.ts | 32 + .../taro-vite-runner/__tests__/mocks/vue.ts | 4 + .../taro-vite-runner/__tests__/setup/index.ts | 25 + .../__tests__/utils/compiler.ts | 128 + .../__tests__/utils/config.ts | 46 + .../__tests__/utils/helper.ts | 68 + packages/taro-vite-runner/package.json | 12 +- packages/taro-vite-runner/src/mini/entry.ts | 3 +- pnpm-lock.yaml | 28868 +++++++++------- 235 files changed, 87311 insertions(+), 12234 deletions(-) create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/babel.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/compiler-macros.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/config.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/css-modules.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/framework.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/mini-platform.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/mini-split-chunks.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/parse-html.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/prerender.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/sass.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/skyline.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/subpackages.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/tabbar.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/ts.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/__snapshots__/wx-hybrid.spec.ts.snap create mode 100644 packages/taro-vite-runner/__tests__/babel.spec.ts create mode 100644 packages/taro-vite-runner/__tests__/bundled/globby/index.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/babel/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/app.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/components/title/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/components/title/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/components/title/index.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/pages/about/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/pages/about/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/common-style/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/compiler-macros/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/alias/files/index/index.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/alias/utils/index.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/irrelevant.txt create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/config/origin/weapp/index.wxml create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/index.global.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/css-modules/src/pages/index/index.module.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/assets/nav.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/assets/nav_red.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/assets/view.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/assets/view_red.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/custom-tab-bar/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/custom-tab-bar/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/custom-tab-bar/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/pages/detail/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/pages/detail/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/custom-tabbar/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/css/sub-common.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/css/sub-common.module.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/css/sub-vendors.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/css/sub-vendors.module.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageA/detail/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageA/detail/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageA/detail/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageA/my/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageA/my/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageB/list/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/packageB/list/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/utils/consoleLogMain.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/utils/consoleLogSubCommon.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/utils/consoleLogSubVendors.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/utils/testExcludeFunction.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/mini-split-chunks/src/utils/testExcludeString.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/parse-html/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/others/detail/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/others/detail/region.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/others/normal/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/prerender/vmMock.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/react/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/input/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/input/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/input/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/input/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/input/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/input/pages/index/index.sass create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/app.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/common/global.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/sass/src/pages/index/index.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/skyline/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/packageA/common.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/packageA/detail/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/packageA/detail/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/packageA/detail/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/packageA/my/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/packageA/my/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/subpackages/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/app.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/assets/nav.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/assets/nav_red.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/assets/view.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/assets/view_red.png create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/pages/about/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/pages/about/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/tabbar/src/pages/index/index.jsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/global.d.ts create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/app.config.ts create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/app.less create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/app.ts create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/pages/index/index.config.ts create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/pages/index/index.less create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/src/pages/index/index.tsx create mode 100644 packages/taro-vite-runner/__tests__/fixtures/typescript/tsconfig.json create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/app.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/pages/index/index.css create mode 100644 packages/taro-vite-runner/__tests__/fixtures/vue3/src/pages/index/index.vue create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/babel.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/app.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/app.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/app.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/components/tab/tab.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/components/tab/tab.json create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/components/tab/tab.wxml create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/index.html create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/index/index.config.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/index/index.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/index/index.scss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/native/native.js create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/native/native.json create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/native/native.wxml create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/pages/native/native.wxss create mode 100644 packages/taro-vite-runner/__tests__/fixtures/wx-hybrid/src/utils/util.js create mode 100644 packages/taro-vite-runner/__tests__/mocks/deps.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/nerv.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/react-refresh.js create mode 100644 packages/taro-vite-runner/__tests__/mocks/react.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro-components.css create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro-components.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro-react.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro-router.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro-runtime.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro-shared.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/taro.ts create mode 100644 packages/taro-vite-runner/__tests__/mocks/vue.ts create mode 100644 packages/taro-vite-runner/__tests__/setup/index.ts create mode 100644 packages/taro-vite-runner/__tests__/utils/compiler.ts create mode 100644 packages/taro-vite-runner/__tests__/utils/config.ts create mode 100644 packages/taro-vite-runner/__tests__/utils/helper.ts diff --git a/packages/taro-vite-runner/__tests__/__snapshots__/babel.spec.ts.snap b/packages/taro-vite-runner/__tests__/__snapshots__/babel.spec.ts.snap new file mode 100644 index 000000000000..9422c4960aab --- /dev/null +++ b/packages/taro-vite-runner/__tests__/__snapshots__/babel.spec.ts.snap @@ -0,0 +1,1726 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`babel should convert do expressions mini 1`] = `15`; + +exports[`babel should convert do expressions mini 2`] = ` +" +/** filePath: dist/app.js **/ +"use strict"; + +require("./common"); + +require("./vendors"); + +require("./runtime"); + +(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([ [ 524 ], { + 260: function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { + function mergeReconciler() {} + function mergeInternalComponents() {} + function isArray() {} + function isFunction() {} + function isNumber() {} + function isNull() {} + function isObject() {} + function isString() {} + function isUndefined() {} + function isWebPlatform() {} + function getComponentsAlias() {} + function controlledComponent() {} + function internalComponents() {} + function toCamelCase() {} + function toDashed() {} + function processApis() {} + function singleQuote() {} + const EMPTY_OBJ = {}; + const hooks = {}; + function Events() {} + function ensure() {} + function noop() {} + function warn() {} + var taro_shared = "taro-shared-mock"; + const needPromiseApis = new Set([ "addFileToFavorites", "addVideoToFavorites", "authPrivateMessage", "checkIsAddedToMyMiniProgram", "chooseContact", "cropImage", "disableAlertBeforeUnload", "editImage", "enableAlertBeforeUnload", "getBackgroundFetchData", "getChannelsLiveInfo", "getChannelsLiveNoticeInfo", "getFuzzyLocation", "getGroupEnterInfo", "getLocalIPAddress", "getShareInfo", "getUserProfile", "getWeRunData", "join1v1Chat", "openChannelsActivity", "openChannelsEvent", "openChannelsLive", "openChannelsUserProfile", "openCustomerServiceChat", "openVideoEditor", "saveFileToDisk", "scanItem", "setEnable1v1Chat", "setWindowSize", "sendBizRedPacket", "startFacialRecognitionVerify" ]); + function initNativeApi(taro) { + processApis(taro, wx, { + needPromiseApis: needPromiseApis, + modifyApis(apis) { + apis.delete("lanDebug"); + }, + transformMeta(api, options) { + var _a; + if (api === "showShareMenu") { + options.menus = (_a = options.showShareItems) === null || _a === void 0 ? void 0 : _a.map((item => item === "wechatFriends" ? "shareAppMessage" : item === "wechatMoment" ? "shareTimeline" : item)); + } + return { + key: api, + options: options + }; + } + }); + taro.cloud = wx.cloud; + taro.getTabBar = function(pageCtx) { + var _a; + if (typeof (pageCtx === null || pageCtx === void 0 ? void 0 : pageCtx.getTabBar) === "function") { + return (_a = pageCtx.getTabBar()) === null || _a === void 0 ? void 0 : _a.$taroInstances; + } + }; + taro.getRenderer = function() { + var _a, _b, _c; + return (_c = (_b = (_a = taro.getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.page) === null || _b === void 0 ? void 0 : _b.renderer) !== null && _c !== void 0 ? _c : "webview"; + }; + } + const _true = "true"; + const _false = "false"; + const _empty = ""; + const _zero = "0"; + const components = { + Progress: { + "border-radius": _zero, + "font-size": "16", + duration: "30", + bindActiveEnd: _empty + }, + RichText: { + space: _empty, + "user-select": _false + }, + Text: { + "user-select": _false, + overflow: "visible", + "max-lines": "" + }, + Map: { + polygons: "[]", + subkey: _empty, + rotate: _zero, + skew: _zero, + "max-scale": "20", + "min-scale": "3", + "enable-3D": _false, + "show-compass": _false, + "show-scale": _false, + "enable-overlooking": _false, + "enable-auto-max-overlooking": _false, + "enable-zoom": _true, + "enable-scroll": _true, + "enable-rotate": _false, + "enable-satellite": _false, + "enable-traffic": _false, + "enable-poi": _true, + "enable-building": _true, + setting: "[]", + bindLabelTap: _empty, + bindRegionChange: _empty, + bindPoiTap: _empty, + bindPolylineTap: _empty, + bindAbilitySuccess: _empty, + bindAbilityFailed: _empty, + bindAuthSuccess: _empty, + bindInterpolatePoint: _empty, + bindError: _empty, + bindAnchorPointTap: _empty + }, + Button: { + lang: "en", + "session-from": _empty, + "send-message-title": _empty, + "send-message-path": _empty, + "send-message-img": _empty, + "app-parameter": _empty, + "show-message-card": _false, + "business-id": _empty, + bindGetUserInfo: _empty, + bindContact: _empty, + bindGetPhoneNumber: _empty, + bindGetRealTimePhoneNumber: _empty, + bindChooseAvatar: _empty, + bindError: _empty, + bindOpenSetting: _empty, + bindLaunchApp: _empty, + bindAgreePrivacyAuthorization: _empty + }, + Form: { + "report-submit-timeout": _zero + }, + Input: { + "always-embed": _false, + "adjust-position": _true, + "hold-keyboard": _false, + "safe-password-cert-path": "", + "safe-password-length": "", + "safe-password-time-stamp": "", + "safe-password-nonce": "", + "safe-password-salt": "", + "safe-password-custom-hash": "", + "auto-fill": _empty, + bindKeyboardHeightChange: _empty, + bindNicknameReview: _empty + }, + Picker: { + "header-text": _empty, + level: "region" + }, + PickerView: { + "immediate-change": _false, + bindPickStart: _empty, + bindPickEnd: _empty + }, + Slider: { + color: "'#e9e9e9'", + "selected-color": "'#1aad19'" + }, + Textarea: { + "show-confirm-bar": _true, + "adjust-position": _true, + "hold-keyboard": _false, + "disable-default-padding": _false, + "confirm-type": "'return'", + "confirm-hold": _false, + bindKeyboardHeightChange: _empty + }, + ScrollView: { + "enable-flex": _false, + "scroll-anchoring": _false, + enhanced: _false, + "using-sticky": _false, + "paging-enabled": _false, + "enable-passive": _false, + "refresher-enabled": _false, + "refresher-threshold": "45", + "refresher-default-style": "'black'", + "refresher-background": "'#FFF'", + "refresher-triggered": _false, + bounces: _true, + "show-scrollbar": _true, + "fast-deceleration": _false, + type: "'list'", + reverse: _false, + clip: _true, + "enable-back-to-top": _false, + "cache-extent": _empty, + "min-drag-distance": "18", + "scroll-into-view-within-extent": _false, + "scroll-into-view-alignment": "'start'", + padding: "[0,0,0,0]", + "refresher-two-level-enabled": _false, + "refresher-two-level-triggered": _false, + "refresher-two-level-threshold": "150", + "refresher-two-level-close-threshold": "80", + "refresher-two-level-scroll-enabled": _false, + "refresher-ballistic-refresh-enabled": _false, + "refresher-two-level-pinned": _false, + bindDragStart: _empty, + bindDragging: _empty, + bindDragEnd: _empty, + bindRefresherPulling: _empty, + bindRefresherRefresh: _empty, + bindRefresherRestore: _empty, + bindRefresherAbort: _empty, + bindScrollStart: _empty, + bindScrollEnd: _empty, + bindRefresherWillRefresh: _empty, + bindRefresherStatusChange: _empty + }, + StickySection: { + "push-pinned-header": _true, + padding: "[0, 0, 0, 0]" + }, + GridView: { + type: "'aligned'", + "cross-axis-count": "2", + "max-cross-axis-extent": _zero, + "main-axis-gap": _zero, + "cross-axis-gap": _zero, + padding: "[0, 0, 0, 0]" + }, + GridBuilder: { + type: "'aligned'", + list: "[]", + "cross-axis-count": "2", + "max-cross-axis-extent": _zero, + "main-axis-gap": _zero, + "cross-axis-gap": _zero, + padding: "[0, 0, 0, 0]", + bindItemBuild: _empty, + bindItemDispose: _empty + }, + ListView: { + padding: "[0, 0, 0, 0]" + }, + ListBuilder: { + list: "[]", + type: "static", + padding: "[0, 0, 0, 0]", + "child-count": _empty, + "child-height": _empty, + bindItemBuild: _empty, + bindItemDispose: _empty + }, + StickyHeader: { + "offset-top": "0", + padding: "[0, 0, 0, 0]" + }, + Swiper: { + "snap-to-edge": _false, + "easing-function": "'default'" + }, + SwiperItem: { + "skip-hidden-item-layout": _false + }, + Navigator: { + target: "'self'", + "app-id": _empty, + path: _empty, + "extra-data": _empty, + version: "'version'" + }, + Camera: { + mode: "'normal'", + resolution: "'medium'", + "frame-size": "'medium'", + bindInitDone: _empty, + bindScanCode: _empty + }, + Image: { + webp: _false, + "show-menu-by-longpress": _false + }, + LivePlayer: { + mode: "'live'", + "sound-mode": "'speaker'", + "auto-pause-if-navigate": _true, + "auto-pause-if-open-native": _true, + "picture-in-picture-mode": "[]", + "enable-auto-rotation": _false, + "referrer-policy": "'no-referrer'", + "enable-casting": _false, + bindstatechange: _empty, + bindfullscreenchange: _empty, + bindnetstatus: _empty, + bindAudioVolumeNotify: _empty, + bindEnterPictureInPicture: _empty, + bindLeavePictureInPicture: _empty, + bindCastingUserSelect: _empty, + bindCastingStateChange: _empty, + bindCastingInterrupt: _empty + }, + Video: { + title: _empty, + "play-btn-position": "'bottom'", + "enable-play-gesture": _false, + "auto-pause-if-navigate": _true, + "auto-pause-if-open-native": _true, + "vslide-gesture": _false, + "vslide-gesture-in-fullscreen": _true, + "show-bottom-progress": _true, + "ad-unit-id": _empty, + "poster-for-crawler": _empty, + "show-casting-button": _false, + "picture-in-picture-mode": "[]", + "enable-auto-rotation": _false, + "show-screen-lock-button": _false, + "show-snapshot-button": _false, + "show-background-playback-button": _false, + "background-poster": _empty, + "referrer-policy": "'no-referrer'", + "is-drm": _false, + "is-live": _false, + "provision-url": _empty, + "certificate-url": _empty, + "license-url": _empty, + "preferred-peak-bit-rate": _empty, + bindProgress: _empty, + bindLoadedMetadata: _empty, + bindControlsToggle: _empty, + bindEnterPictureInPicture: _empty, + bindLeavePictureInPicture: _empty, + bindSeekComplete: _empty, + bindCastingUserSelect: _empty, + bindCastingStateChange: _empty, + bindCastingInterrupt: _empty, + bindAdLoad: _empty, + bindAdError: _empty, + bindAdClose: _empty, + bindAdPlay: _empty + }, + Canvas: { + type: _empty + }, + Ad: { + "ad-type": "'banner'", + "ad-theme": "'white'" + }, + CoverView: { + "marker-id": _empty, + slot: _empty + }, + Editor: { + "read-only": _false, + placeholder: _empty, + "show-img-size": _false, + "show-img-toolbar": _false, + "show-img-resize": _false, + focus: _false, + bindReady: _empty, + bindFocus: _empty, + bindBlur: _empty, + bindInput: _empty, + bindStatusChange: _empty, + name: _empty + }, + MatchMedia: { + "min-width": _empty, + "max-width": _empty, + width: _empty, + "min-height": _empty, + "max-height": _empty, + height: _empty, + orientation: _empty + }, + FunctionalPageNavigator: { + version: "'release'", + name: _empty, + args: _empty, + bindSuccess: _empty, + bindFail: _empty, + bindCancel: _empty + }, + LivePusher: { + url: _empty, + mode: "'RTC'", + autopush: _false, + muted: _false, + "enable-camera": _true, + "auto-focus": _true, + orientation: "'vertical'", + beauty: _zero, + whiteness: _zero, + aspect: "'9:16'", + "min-bitrate": "200", + "max-bitrate": "1000", + "audio-quality": "'high'", + "waiting-image": _empty, + "waiting-image-hash": _empty, + zoom: _false, + "device-position": "'front'", + "background-mute": _false, + mirror: _false, + "remote-mirror": _false, + "local-mirror": _false, + "audio-reverb-type": _zero, + "enable-mic": _true, + "enable-agc": _false, + "enable-ans": _false, + "audio-volume-type": "'voicecall'", + "video-width": "360", + "video-height": "640", + "beauty-style": "'smooth'", + filter: "'standard'", + "picture-in-picture-mode": "[]", + animation: _empty, + bindStateChange: _empty, + bindNetStatus: _empty, + bindBgmStart: _empty, + bindBgmProgress: _empty, + bindBgmComplete: _empty, + bindAudioVolumeNotify: _empty + }, + OfficialAccount: { + bindLoad: _empty, + bindError: _empty + }, + OpenData: { + type: _empty, + "open-gid": _empty, + lang: "'en'", + "default-text": _empty, + "default-avatar": _empty, + bindError: _empty + }, + NavigationBar: { + title: _empty, + loading: _false, + "front-color": "'#000000'", + "background-color": _empty, + "color-animation-duration": _zero, + "color-animation-timing-func": "'linear'" + }, + PageMeta: { + "background-text-style": _empty, + "background-color": _empty, + "background-color-top": _empty, + "background-color-bottom": _empty, + "root-background-color": _empty, + "scroll-top": "''", + "scroll-duration": "300", + "page-style": "''", + "root-font-size": "''", + "page-orientation": "''", + bindResize: _empty, + bindScroll: _empty, + bindScrollDone: _empty + }, + VoipRoom: { + openid: _empty, + mode: "'camera'", + "device-position": "'front'", + bindError: _empty + }, + AdCustom: { + "unit-id": _empty, + "ad-intervals": _empty, + bindLoad: _empty, + bindError: _empty + }, + PageContainer: { + show: _false, + duration: "300", + "z-index": "100", + overlay: _true, + position: "'bottom'", + round: _false, + "close-on-slide-down": _false, + "overlay-style": _empty, + "custom-style": _empty, + bindBeforeEnter: _empty, + bindEnter: _empty, + bindAfterEnter: _empty, + bindBeforeLeave: _empty, + bindLeave: _empty, + bindAfterLeave: _empty, + bindClickOverlay: _empty + }, + ShareElement: { + mapkey: _empty, + transform: _false, + duration: "300", + "easing-function": "'ease-out'" + }, + KeyboardAccessory: {}, + RootPortal: { + enable: _true + }, + ChannelLive: { + "feed-id": _empty, + "finder-user-name": _empty + }, + ChannelVideo: { + "feed-id": _empty, + "finder-user-name": _empty, + "feed-token": _empty, + autoplay: _false, + loop: _false, + muted: _false, + "object-fit": "'contain'", + bindError: _empty + }, + Snapshot: { + mode: "'view'" + }, + Span: {}, + OpenContainer: { + transitionType: "'fade'", + transitionDuration: "300", + closedColor: "'white'", + closedElevation: _zero, + closeBorderRadius: _zero, + middleColor: _empty, + openColor: "'white'", + openElevation: _zero, + openBorderRadius: _zero + }, + DraggableSheet: { + initialChildSize: "0.5", + minChildSize: "0.25", + maxChildSize: "1.0", + snap: _false, + snapSizes: "[]" + }, + NestedScrollHeader: {}, + NestedScrollBody: {} + }; + const hostConfig = { + initNativeApi: initNativeApi, + getMiniLifecycle(config) { + const methods = config.page[5]; + if (methods.indexOf("onSaveExitState") === -1) { + methods.push("onSaveExitState"); + } + return config; + }, + transferHydrateData(data, element, componentsAlias) { + var _a; + if (element.isTransferElement) { + const pages = getCurrentPages(); + const page = pages[pages.length - 1]; + data["nn"] = element.dataName; + page.setData({ + [toCamelCase(data.nn)]: data + }); + return { + sid: element.sid, + ["v"]: "", + ["nn"]: ((_a = componentsAlias["#text"]) === null || _a === void 0 ? void 0 : _a._num) || "8" + }; + } + } + }; + mergeReconciler(hostConfig); + mergeInternalComponents(components); + var taro_runtime = __webpack_require__(103); + function setReconciler() {} + function connectReactPage() {} + function createReactApp() {} + function createNativeComponentConfig() {} + function createVue3App() {} + const setGlobalDataPlugin = {}; + function useDidHide() {} + function useDidShow() {} + function useError() {} + function useLaunch() {} + function usePageNotFound() {} + function useLoad() {} + function usePageScroll() {} + function usePullDownRefresh() {} + function usePullIntercept() {} + function useReachBottom() {} + function useResize() {} + function useUnload() {} + function useAddToFavorites() {} + function useOptionMenuClick() {} + function useSaveExitState() {} + function useShareAppMessage() {} + function useShareTimeline() {} + function useTitleClick() {} + function useReady() {} + function useRouter() {} + function useTabItemTap() {} + function useScope() {} + function initPxTransform() {} + var taro = "taro"; + var classCallCheck = __webpack_require__(246); + var createClass = __webpack_require__(697); + var callSuper = __webpack_require__(170); + var inherits = __webpack_require__(912); + var react = __webpack_require__(831); + var app_App = function(_Component) { + function App() { + (0, classCallCheck.A)(this, App); + return (0, callSuper.A)(this, App, arguments); + } + (0, inherits.A)(App, _Component); + return (0, createClass.A)(App, [ { + key: "componentDidMount", + value: function componentDidMount() {} + }, { + key: "componentDidShow", + value: function componentDidShow() {} + }, { + key: "componentDidHide", + value: function componentDidHide() {} + }, { + key: "render", + value: function render() { + return this.props.children; + } + } ]); + }(react.Component); + var app = app_App; + var taro_react = "taro-react-mock"; + var config = { + pages: [ "pages/index/index" ], + window: { + backgroundTextStyle: "light", + navigationBarBackgroundColor: "#fff", + navigationBarTitleText: "WeChat", + navigationBarTextStyle: "black" + } + }; + taro_runtime.x.__taroAppConfig = config; + var inst = App(createReactApp(app, react, taro_react, config)); + initPxTransform({ + designWidth: 750, + deviceRatio: { + 640: 1.17, + 750: 1, + 828: .905 + }, + baseFontSize: 20, + unitPrecision: undefined, + targetUnit: undefined + }); + } +}, function(__webpack_require__) { + var __webpack_exec__ = function(moduleId) { + return __webpack_require__(__webpack_require__.s = moduleId); + }; + __webpack_require__.O(0, [ 96, 76 ], (function() { + return __webpack_exec__(260); + })); + var __webpack_exports__ = __webpack_require__.O(); +} ]); + + + +/** filePath: dist/app.json **/ +{"pages":["pages/index/index"],"window":{"backgroundTextStyle":"light","navigationBarBackgroundColor":"#fff","navigationBarTitleText":"WeChat","navigationBarTextStyle":"black"}} + +/** filePath: dist/app.wxss **/ + +/** filePath: dist/base.wxml **/ + +