UNPKG

weapp-vite

Version:

weapp-vite 一个现代化的小程序打包工具

34 lines (24 loc) 1.63 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _chunkANDG4OMEcjs = require('./chunk-ANDG4OME.cjs'); var _chunkN5FVU7GRcjs = require('./chunk-N5FVU7GR.cjs'); // src/createContext.ts _chunkN5FVU7GRcjs.init_cjs_shims.call(void 0, ); async function createCompilerContext(options) { const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.key]), () => ( "default")); if (!_optionalChain([options, 'optionalAccess', _2 => _2.key])) { _chunkANDG4OMEcjs.resetCompilerContext.call(void 0, key); } _chunkANDG4OMEcjs.setActiveCompilerContextKey.call(void 0, key); const ctx = _chunkANDG4OMEcjs.getCompilerContext.call(void 0, key); const { configService, scanService, autoRoutesService } = ctx; await configService.load(options); if (autoRoutesService) { await autoRoutesService.ensureFresh(); } try { await scanService.loadAppEntry(); } catch (e) { } return ctx; } exports.createCompilerContext = createCompilerContext;