diff --git a/package.json b/package.json index 4e636c4..67cbd58 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "dev:test:mp-weixin": "uni -p mp-weixin --mode test", "build:test:mp-weixin": "uni build -p mp-weixin --mode test", "build:mp-weixin": "uni build -p mp-weixin --mode production", + "verify:arrival-build": "node scripts/verify-arrival-navigation-build.cjs", "test:unit": "vitest run", "type-check": "vue-tsc --noEmit", "lint": "eslint \"src/**/*.{ts,vue}\"" @@ -37,9 +38,12 @@ "@types/three": "0.163.0", "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", + "@vitejs/plugin-vue": "5.2.4", "@vue/runtime-core": "3.4.21", + "@vue/test-utils": "2.4.6", "eslint": "8.57.1", "eslint-plugin-vue": "9.30.0", + "happy-dom": "14.12.3", "sass": "1.99.0", "sass-embedded": "1.99.0", "typescript": "5.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f9123c2..30a4357 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,15 +51,24 @@ importers: '@typescript-eslint/parser': specifier: 7.18.0 version: 7.18.0(eslint@8.57.1)(typescript@5.3.3) + '@vitejs/plugin-vue': + specifier: 5.2.4 + version: 5.2.4(vite@5.2.8(@types/node@25.9.1)(sass@1.99.0)(terser@5.47.1))(vue@3.4.21(typescript@5.3.3)) '@vue/runtime-core': specifier: 3.4.21 version: 3.4.21 + '@vue/test-utils': + specifier: 2.4.6 + version: 2.4.6 eslint: specifier: 8.57.1 version: 8.57.1 eslint-plugin-vue: specifier: 9.30.0 version: 9.30.0(eslint@8.57.1) + happy-dom: + specifier: 14.12.3 + version: 14.12.3 sass: specifier: 1.99.0 version: 1.99.0 @@ -74,7 +83,7 @@ importers: version: 5.2.8(@types/node@25.9.1)(sass@1.99.0)(terser@5.47.1) vitest: specifier: 1.6.1 - version: 1.6.1(@types/node@25.9.1)(jsdom@16.7.0)(sass@1.99.0)(terser@5.47.1) + version: 1.6.1(@types/node@25.9.1)(happy-dom@14.12.3)(jsdom@16.7.0)(sass@1.99.0)(terser@5.47.1) vue-eslint-parser: specifier: 9.4.3 version: 9.4.3(eslint@8.57.1) @@ -1272,6 +1281,9 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@one-ini/wasm@0.1.1': + resolution: {integrity: sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==} + '@parcel/watcher-android-arm64@2.5.6': resolution: {integrity: sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==} engines: {node: '>= 10.0.0'} @@ -1764,10 +1776,16 @@ packages: '@vue/shared@3.5.34': resolution: {integrity: sha512-24uqU4OIiX29ryC3MeWid/Xf2fa2EFRUVLb77nRhk+UrTVrh/XiGtFAFmJBAtBRbjwNdsPRP+jj/OL27Eg1NDA==} + '@vue/test-utils@2.4.6': + resolution: {integrity: sha512-FMxEjOpYNYiFe0GkaHsnJPXFHxQ6m4t8vI/ElPGpMWxZKpmRvQ33OIrvRXemy6yha03RxhOlQuy+gZMC3CQSow==} + abab@2.0.6: resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} deprecated: Use your platform's native atob() and btoa() methods instead + abbrev@1.0.3: + resolution: {integrity: sha512-s07HMJf6O5iTLVDx9cH7c9VbOdrmzxE+AzWz9CPi94zVNBQQA3jIwIZKTrHQj4dGR1T/MdwMnVJzSpjaVEXtXw==} + accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} @@ -2075,6 +2093,10 @@ packages: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} + commander@10.0.0: + resolution: {integrity: sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==} + engines: {node: '>=14'} + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -2093,6 +2115,9 @@ packages: confbox@0.2.4: resolution: {integrity: sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==} + config-chain@1.1.13: + resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} + content-disposition@0.5.4: resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} engines: {node: '>= 0.6'} @@ -2270,6 +2295,11 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} + editorconfig@1.0.7: + resolution: {integrity: sha512-e0GOtq/aTQhVdNyDU9e02+wz9oDDM+SIOQxWME2QRjzRX5yyLAuHDE+0aE8vHb9XRC8XD37eO2u57+F09JqFhw==} + engines: {node: '>=14'} + hasBin: true + ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} @@ -2573,6 +2603,11 @@ packages: resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + deprecated: Glob versions prior to v9 are no longer supported + global@4.4.0: resolution: {integrity: sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==} @@ -2594,6 +2629,10 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + happy-dom@14.12.3: + resolution: {integrity: sha512-vsYlEs3E9gLwA1Hp+w3qzu+RUDFf4VTT8cyKqVICoZ2k7WM++Qyd2LwzyTi5bqMJFiIC/vNpTDYuxdreENRK/g==} + engines: {node: '>=16.0.0'} + has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} @@ -2695,6 +2734,10 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + ini@1.3.4: + resolution: {integrity: sha512-VUA7WAWNCWfm6/8f9kAb8Y6iGBWnmCfgFS5dTrv2C38LLm1KUmpY388mCVCJCsMKQomvOQ1oW8/edXdChd9ZXQ==} + deprecated: Please update to ini >=1.3.6 to avoid a prototype pollution issue + invert-kv@3.0.1: resolution: {integrity: sha512-CYdFeFexxhv/Bcny+Q0BfOV+ltRlJcd4BBZBYFX/O0u4npJrgZtIcjokegtiSMAvlMTJ+Koq0GBCc//3bueQxw==} engines: {node: '>=8'} @@ -2926,6 +2969,11 @@ packages: jpeg-js@0.3.7: resolution: {integrity: sha512-9IXdWudL61npZjvLuVe/ktHiA41iE8qFyLB+4VDTblEsWBzeg8WQTlktdUK4CdncUqtUgUg0bbOmTE2bKBKaBQ==} + js-beautify@1.14.9: + resolution: {integrity: sha512-coM7xq1syLcMyuVGyToxcj2AlzhkDjmfklL8r0JgJ7A76wyGMpJ1oA35mr4APdYNO/o/4YY8H54NQIJzhMbhBg==} + engines: {node: '>=12'} + hasBin: true + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -3141,6 +3189,10 @@ packages: minimatch@3.1.5: resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} + minimatch@5.1.9: + resolution: {integrity: sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==} + engines: {node: '>=10'} + minimatch@9.0.9: resolution: {integrity: sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==} engines: {node: '>=16 || 14 >=14.17'} @@ -3189,6 +3241,11 @@ packages: resolution: {integrity: sha512-iIbHXV9eBB2nB0wa7oTsrrXq+qQt+9SIlx9AX3T96YgobtEQfis5n6TJ6vV+3QP8DwdriEAcGhARaFCu37peBg==} engines: {node: '>=18'} + nopt@6.0.0: + resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + hasBin: true + normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -3471,6 +3528,9 @@ packages: resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} engines: {node: '>= 6'} + proto-list@1.2.4: + resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} + proxy-addr@2.0.7: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} @@ -4172,6 +4232,9 @@ packages: jsdom: optional: true + vue-component-type-helpers@2.0.0: + resolution: {integrity: sha512-r+lO2aYasxliE6I76dutaY0GBCnqM7Q/c3VO2MPxrJsIUwPZIESLfis9/1EXAMWajnpF+o0syJAIV6Y6/crKNw==} + vue-eslint-parser@9.4.3: resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==} engines: {node: ^14.17.0 || >=16.0.0} @@ -4219,6 +4282,10 @@ packages: resolution: {integrity: sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==} engines: {node: '>=10.4'} + webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + webpack-virtual-modules@0.6.2: resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==} @@ -4228,6 +4295,10 @@ packages: whatwg-mimetype@2.3.0: resolution: {integrity: sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==} + whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + whatwg-url@8.7.0: resolution: {integrity: sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==} engines: {node: '>=10'} @@ -6245,6 +6316,8 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.20.1 + '@one-ini/wasm@0.1.1': {} + '@parcel/watcher-android-arm64@2.5.6': optional: true @@ -6759,8 +6832,15 @@ snapshots: '@vue/shared@3.5.34': {} + '@vue/test-utils@2.4.6': + dependencies: + js-beautify: 1.14.9 + vue-component-type-helpers: 2.0.0 + abab@2.0.6: {} + abbrev@1.0.3: {} + accepts@1.3.8: dependencies: mime-types: 2.1.35 @@ -7106,6 +7186,8 @@ snapshots: dependencies: delayed-stream: 1.0.0 + commander@10.0.0: {} + commander@2.20.3: {} compare-versions@3.6.0: {} @@ -7118,6 +7200,11 @@ snapshots: confbox@0.2.4: {} + config-chain@1.1.13: + dependencies: + ini: 1.3.4 + proto-list: 1.2.4 + content-disposition@0.5.4: dependencies: safe-buffer: 5.2.1 @@ -7245,6 +7332,13 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 + editorconfig@1.0.7: + dependencies: + '@one-ini/wasm': 0.1.1 + commander: 10.0.0 + minimatch: 9.0.9 + semver: 7.8.0 + ee-first@1.1.1: {} electron-to-chromium@1.5.360: {} @@ -7637,6 +7731,14 @@ snapshots: once: 1.4.0 path-is-absolute: 1.0.1 + glob@8.1.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.9 + once: 1.4.0 + global@4.4.0: dependencies: min-document: 2.19.2 @@ -7661,6 +7763,12 @@ snapshots: graphemer@1.4.0: {} + happy-dom@14.12.3: + dependencies: + entities: 4.5.0 + webidl-conversions: 7.0.0 + whatwg-mimetype: 3.0.0 + has-flag@3.0.0: {} has-flag@4.0.0: {} @@ -7751,6 +7859,8 @@ snapshots: inherits@2.0.4: {} + ini@1.3.4: {} + invert-kv@3.0.1: {} ipaddr.js@1.9.1: {} @@ -8194,6 +8304,13 @@ snapshots: jpeg-js@0.3.7: {} + js-beautify@1.14.9: + dependencies: + config-chain: 1.1.13 + editorconfig: 1.0.7 + glob: 8.1.0 + nopt: 6.0.0 + js-tokens@4.0.0: {} js-tokens@9.0.1: {} @@ -8401,6 +8518,10 @@ snapshots: dependencies: brace-expansion: 1.1.14 + minimatch@5.1.9: + dependencies: + brace-expansion: 2.1.0 + minimatch@9.0.9: dependencies: brace-expansion: 2.1.0 @@ -8439,6 +8560,10 @@ snapshots: node-releases@2.0.45: {} + nopt@6.0.0: + dependencies: + abbrev: 1.0.3 + normalize-path@3.0.0: {} normalize-range@0.1.2: {} @@ -8706,6 +8831,8 @@ snapshots: kleur: 3.0.3 sisteransi: 1.0.5 + proto-list@1.2.4: {} + proxy-addr@2.0.7: dependencies: forwarded: 0.2.0 @@ -9350,7 +9477,7 @@ snapshots: sass: 1.99.0 terser: 5.47.1 - vitest@1.6.1(@types/node@25.9.1)(jsdom@16.7.0)(sass@1.99.0)(terser@5.47.1): + vitest@1.6.1(@types/node@25.9.1)(happy-dom@14.12.3)(jsdom@16.7.0)(sass@1.99.0)(terser@5.47.1): dependencies: '@vitest/expect': 1.6.1 '@vitest/runner': 1.6.1 @@ -9374,6 +9501,7 @@ snapshots: why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 25.9.1 + happy-dom: 14.12.3 jsdom: 16.7.0 transitivePeerDependencies: - less @@ -9384,6 +9512,8 @@ snapshots: - supports-color - terser + vue-component-type-helpers@2.0.0: {} + vue-eslint-parser@9.4.3(eslint@8.57.1): dependencies: debug: 4.4.3 @@ -9440,6 +9570,8 @@ snapshots: webidl-conversions@6.1.0: {} + webidl-conversions@7.0.0: {} + webpack-virtual-modules@0.6.2: {} whatwg-encoding@1.0.5: @@ -9448,6 +9580,8 @@ snapshots: whatwg-mimetype@2.3.0: {} + whatwg-mimetype@3.0.0: {} + whatwg-url@8.7.0: dependencies: lodash: 4.18.1 diff --git a/scripts/verify-arrival-navigation-build.cjs b/scripts/verify-arrival-navigation-build.cjs new file mode 100644 index 0000000..f56cc32 --- /dev/null +++ b/scripts/verify-arrival-navigation-build.cjs @@ -0,0 +1,107 @@ +const fs = require('node:fs') +const path = require('node:path') + +const projectRoot = path.resolve(__dirname, '..') +const h5Root = path.resolve(projectRoot, process.argv[2] || path.join('dist', 'build', 'h5')) +const mpRoot = path.resolve(projectRoot, process.argv[3] || path.join('dist', 'build', 'mp-weixin')) + +const readText = (filePath) => fs.readFileSync(filePath, 'utf8') + +const assertContains = (source, value, label) => { + if (!source.includes(value)) { + throw new Error(`${label} 缺少:${value}`) + } +} + +const assertNotContains = (source, value, label) => { + if (source.includes(value)) { + throw new Error(`${label} 不应包含:${value}`) + } +} + +const collectJavaScriptFiles = (root) => fs.readdirSync(root, { withFileTypes: true }) + .flatMap((entry) => { + const entryPath = path.join(root, entry.name) + if (entry.isDirectory()) return collectJavaScriptFiles(entryPath) + return entry.isFile() && entry.name.endsWith('.js') ? [entryPath] : [] + }) + +const htmlPath = path.join(h5Root, 'index.html') +const html = readText(htmlPath) +const entryMatch = html.match(/]+src="([^"]+\.js)"/) +if (!entryMatch) throw new Error('H5 index.html 未找到入口 JS') + +const entryPath = path.join(h5Root, entryMatch[1].replace(/^\//, '')) +const entryCode = readText(entryPath) +const pageChunkMatch = entryCode.match(/pages-index-index\.[A-Za-z0-9_-]+\.js/) +if (!pageChunkMatch) throw new Error('H5 入口 JS 未找到首页页面 chunk') + +const pageChunkPath = path.join(path.dirname(entryPath), pageChunkMatch[0]) +const pageChunkCode = readText(pageChunkPath) +const h5JavaScriptFiles = collectJavaScriptFiles(h5Root) +const h5JavaScriptCode = h5JavaScriptFiles + .map((filePath) => readText(filePath)) + .join('\n') + +for (const required of ['第三方导航', 'third-party-providers']) { + assertContains(pageChunkCode, required, 'H5 首页 chunk') +} + +for (const forbidden of [ + '打开地图导航', + 'native-location', + 'jweixin', + 'wx.miniProgram', + '宿主地图', + '/pages/open-location/index' +]) { + assertNotContains(h5JavaScriptCode, forbidden, 'H5 全量 JS') +} + +if (h5JavaScriptFiles.some((filePath) => path.basename(filePath).includes('pages-open-location-index'))) { + throw new Error('H5 构建不应生成 open-location 页面 chunk') +} + +const mpArrivalPanelPath = path.join( + mpRoot, + 'components', + 'navigation', + 'ArrivalPanel.js' +) +const mpArrivalPanelCode = readText(mpArrivalPanelPath) +const mpArrivalPanelTemplatePath = path.join( + mpRoot, + 'components', + 'navigation', + 'ArrivalPanel.wxml' +) +const mpArrivalPanelTemplate = readText(mpArrivalPanelTemplatePath) +assertContains(mpArrivalPanelCode, '打开地图导航', 'mp-weixin 来馆组件') +assertContains( + mpArrivalPanelCode, + '../../services/WechatOpenLocationService.js', + 'mp-weixin 来馆组件' +) +assertNotContains(mpArrivalPanelCode, 'third-party-providers', 'mp-weixin 来馆组件') +assertNotContains(mpArrivalPanelTemplate, 'provider-sheet', 'mp-weixin 来馆模板') +assertNotContains(mpArrivalPanelTemplate, '第三方导航', 'mp-weixin 来馆模板') + +const mpAppConfigPath = path.join(mpRoot, 'app.json') +const mpAppConfig = JSON.parse(readText(mpAppConfigPath)) +if (!mpAppConfig.pages?.includes('pages/open-location/index')) { + throw new Error('mp-weixin app.json 未注册 open-location 页面') +} + +console.log(JSON.stringify({ + h5: { + html: path.relative(projectRoot, htmlPath), + entry: path.relative(projectRoot, entryPath), + pageChunk: path.relative(projectRoot, pageChunkPath), + navigationMode: 'third-party-providers' + }, + mpWeixin: { + component: path.relative(projectRoot, mpArrivalPanelPath), + template: path.relative(projectRoot, mpArrivalPanelTemplatePath), + navigationMode: 'native-location' + } +}, null, 2)) diff --git a/src/components/navigation/ArrivalPanel.vue b/src/components/navigation/ArrivalPanel.vue index 674de60..5f9cf25 100644 --- a/src/components/navigation/ArrivalPanel.vue +++ b/src/components/navigation/ArrivalPanel.vue @@ -77,6 +77,7 @@ + 打开 + + + + + H5 构建诊断 + 构建 ID:{{ buildDiagnostics.buildId }} + Git commit:{{ buildDiagnostics.gitCommit }} + 构建平台:{{ buildDiagnostics.platform }} + navigationMode:{{ buildDiagnostics.navigationMode }} + 页面 chunk:{{ buildDiagnostics.chunkFileName }} + location.href:{{ buildDiagnostics.href }} + UA:{{ buildDiagnostics.userAgent }} + +