初始化

This commit is contained in:
yziiy
2025-08-11 11:06:07 +08:00
parent 083bc37c00
commit 5607d11395
19772 changed files with 3108723 additions and 18 deletions

View File

@@ -0,0 +1 @@
"use strict";var t=require("./index.js");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}const n=new(e(t).default);let r,o=!1;try{r=require("jest-environment-node")}catch(t){r=require(require.resolve("jest-environment-node",{paths:[process.cwd()]}))}r&&r.TestEnvironment&&(o=!0,r=r.TestEnvironment);module.exports=class extends r{constructor(t,e){super(o?{projectConfig:t}:t),process.env.UNI_AUTOMATOR_CONFIG?this.launchOptions=require(process.env.UNI_AUTOMATOR_CONFIG):this.launchOptions=t.testEnvironmentOptions}async setup(){await super.setup();const e=global;if(e.__init__){if(!e.program)throw Error("Program init failed")}else e.__init__=!0,this.launchOptions.platform=this.launchOptions.platform||process.env.UNI_PLATFORM,e.program=await n.launch(this.launchOptions),this.launchOptions.devtools&&this.launchOptions.devtools.remote&&await e.program.remote(!0);this.global.program=e.program,this.global.uni=t.initUni(e.program)}async teardown(){await super.teardown()}};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";module.exports=async function(){const o=global.program;o&&o.teardown(),await new Promise((o=>{setTimeout((()=>{o(void 0)}),3e3)}))};

View File

@@ -0,0 +1,49 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
exports.default = [
(0, uni_cli_shared_1.defineUniMainJsPlugin)((opts) => {
return {
name: 'uni:automator',
enforce: 'pre',
configResolved() {
if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
return;
}
const pkg = JSON.parse(fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, '../package.json'), 'utf8'));
const automatorJson = JSON.stringify({
version: pkg.version,
wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT,
});
fs_extra_1.default.outputFileSync(path_1.default.resolve(process.env.UNI_OUTPUT_DIR, '../.automator/' + (0, uni_cli_shared_1.getPlatformDir)() + '/.automator.json'), automatorJson);
},
transform(code, id) {
if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
return null;
}
if (opts.filter(id)) {
const platform = process.env.UNI_PLATFORM;
if (platform === 'app' && process.env.UNI_APP_X === 'true') {
const automatorPath = (0, uni_cli_shared_1.normalizePath)((0, uni_cli_shared_1.resolveBuiltIn)(`@dcloudio/uni-app-uts/lib/automator/index.uts`));
return {
code:
// 增加个换行,避免最后是注释且无换行
code + `;\nimport { initAutomator } from '${automatorPath}';`,
map: null,
};
}
const automatorPath = (0, uni_cli_shared_1.normalizePath)((0, uni_cli_shared_1.resolveBuiltIn)(`@dcloudio/uni-${platform === 'app' ? 'app-plus' : platform}/lib/automator.js`));
return {
code: code + `;\nimport '${automatorPath}';`,
map: null,
};
}
},
};
}),
];

View File

@@ -0,0 +1,51 @@
{
"name": "@dcloudio/uni-automator",
"version": "3.0.0-3090520231028001",
"description": "@dcloudio/uni-automator",
"main": "dist/index.js",
"files": [
"dist",
"lib"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-automator"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/dcloudio/uni-app/issues"
},
"uni-app": {
"name": "uniAutomator",
"apply": [
"app",
"h5",
"mp-weixin"
],
"uvue": true
},
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
"dependencies": {
"@dcloudio/uni-cli-shared": "3.0.0-3090520231028001",
"address": "^1.1.2",
"cross-env": "^7.0.3",
"debug": "^4.3.3",
"default-gateway": "^6.0.3",
"fs-extra": "^10.0.0",
"jsonc-parser": "^3.2.0",
"licia": "^1.29.0",
"qrcode-reader": "^1.0.4",
"qrcode-terminal": "^0.12.0",
"ws": "^8.4.2"
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/fs-extra": "^9.0.13"
},
"peerDependencies": {
"jest": "27.0.4",
"jest-environment-node": "27.5.1"
}
}