init commit

This commit is contained in:
rxliuli
2025-11-04 05:03:50 +08:00
commit bce557cc2d
1396 changed files with 172991 additions and 0 deletions

47
node_modules/@jet/environment/runtime/bootstrap.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.exportBootstrap = void 0;
const jet_proxy_1 = require("../dependencies/jet-proxy");
function exportBootstrap(bootstrap) {
if (typeof $exportBootstrap !== "undefined") {
/* Wraps the given bootstrap function to perform custom bootstrap behavior such
as supporting lazy dependencies. */
const customBootstrap = (service) => {
proxyLazyDependencies(service);
return bootstrap(service);
};
$exportBootstrap(customBootstrap);
}
}
exports.exportBootstrap = exportBootstrap;
// We put has_lazy_support on the global object so native can check that the Jet runtime has lazy support.
globalThis["has_lazy_support"] = true;
// Installs proxies for lazy dependencies so we can create objects only as needed.
function proxyLazyDependencies(service) {
const lazyDependencyNames = service.$lazyDependencyNames;
const lazyDependencyNamesSet = new Set(lazyDependencyNames !== null && lazyDependencyNames !== void 0 ? lazyDependencyNames : []);
const lazyGlobalNames = globalThis.$lazyGlobalNames;
const lazyGlobalNamesSet = new Set(lazyGlobalNames !== null && lazyGlobalNames !== void 0 ? lazyGlobalNames : []);
/* We take the union of lazy globals and lazy dependencies. For each lazy dependency name,
we will make one proxy. We must avoid creating more than one proxy for a given name.
For instance, if the name is present in the lazy dependencies and lazy globals, we do
not want to create two proxies. Doing so would cause multiple object instances to be created
natively for use in JS (one instance in the dependency object,
another instance in the global object), leading to potential bugs. */
const uniqueLazyNames = new Set([...lazyDependencyNamesSet, ...lazyGlobalNamesSet]);
const proxyMap = new Map();
const lazyProvider = globalThis.$lazyProvider;
for (const lazyName of uniqueLazyNames) {
// Create one proxy per name present in either lazy globals or lazy dependencies.
proxyMap.set(lazyName, jet_proxy_1.LazyProxyFactory.makeProxy(lazyName, lazyProvider));
}
// For each lazy dependency name, put the proxy on the dependency (service) object under the given name.
for (const lazyDependencyName of lazyDependencyNamesSet) {
service[lazyDependencyName] = proxyMap.get(lazyDependencyName);
}
// For each lazy global name, put the proxy on the global object under the given name.
for (const lazyGlobalName of lazyGlobalNamesSet) {
globalThis[lazyGlobalName] = proxyMap.get(lazyGlobalName);
}
}
//# sourceMappingURL=bootstrap.js.map

19
node_modules/@jet/environment/runtime/index.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./bootstrap"), exports);
__exportStar(require("./runtime"), exports);
//# sourceMappingURL=index.js.map

35
node_modules/@jet/environment/runtime/runtime.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LegacyRuntime = exports.Runtime = void 0;
const isJetEnvironment = typeof exportService === "function";
function nativeExportService(name, service) {
exportService(name, service);
}
class Runtime {
constructor(dispatcher, objectGraph) {
this.dispatcher = dispatcher;
this.objectGraph = objectGraph;
}
async dispatch(intent) {
return await this.dispatcher.dispatch(intent, this.objectGraph);
}
}
exports.Runtime = Runtime;
class LegacyRuntime extends Runtime {
constructor(dispatcher, objectGraph, services) {
super(dispatcher, objectGraph);
this.services = services;
}
serviceWithName(name) {
return this.services[name];
}
exportingService(name, service) {
if (isJetEnvironment) {
nativeExportService(name, service);
}
this.services[name] = service;
return this;
}
}
exports.LegacyRuntime = LegacyRuntime;
//# sourceMappingURL=runtime.js.map