@dcloudio/uni-cli-shared
Advanced tools
Comparing version 2.0.2-alpha-4020920240929001 to 2.0.2-alpha-4030120241010001
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseUTSModuleDeps = exports.capitalize = exports.camelize = exports.parseInjects = exports.parseUniExtApis = exports.getUniExtApiProviderRegisters = exports.getUniExtApiProviders = void 0; | ||
exports.parseUTSModuleDeps = exports.capitalize = exports.camelize = exports.parseInjects = exports.parseUniExtApi = exports.parseUniExtApis = exports.getUniExtApiProviderRegisters = exports.formatExtApiProviderName = exports.getUniExtApiPlugins = exports.getUniExtApiProviders = void 0; | ||
// 重要:此文件编译后的js,需同步至 vue2 编译器中 uni-cli-shared/lib/uts/uni_modules.js | ||
@@ -12,2 +12,3 @@ const path_1 = __importDefault(require("path")); | ||
const extApiProviders = []; | ||
const extApiPlugins = new Set(); | ||
function getUniExtApiProviders() { | ||
@@ -17,2 +18,15 @@ return extApiProviders; | ||
exports.getUniExtApiProviders = getUniExtApiProviders; | ||
function getUniExtApiPlugins() { | ||
return [...extApiPlugins].map((plugin) => { | ||
return { plugin }; | ||
}); | ||
} | ||
exports.getUniExtApiPlugins = getUniExtApiPlugins; | ||
function formatExtApiProviderName(service, name) { | ||
if (service === 'oauth') { | ||
service = 'OAuth'; | ||
} | ||
return `Uni${(0, exports.capitalize)((0, exports.camelize)(service))}${(0, exports.capitalize)((0, exports.camelize)(name))}ProviderImpl`; | ||
} | ||
exports.formatExtApiProviderName = formatExtApiProviderName; | ||
function getUniExtApiProviderRegisters() { | ||
@@ -24,8 +38,5 @@ const result = []; | ||
name: provider.name, | ||
plugin: provider.plugin, | ||
service: provider.service, | ||
class: `uts.sdk.modules.${(0, exports.camelize)(provider.plugin)}.${(0, exports.capitalize)((0, exports.camelize)('uni-ext-api-' + | ||
provider.service + | ||
'-' + | ||
provider.name + | ||
'-provider'))}`, | ||
class: `uts.sdk.modules.${(0, exports.camelize)(provider.plugin)}.${formatExtApiProviderName(provider.service, provider.name)}`, | ||
}); | ||
@@ -47,2 +58,3 @@ } | ||
extApiProviders.length = 0; | ||
extApiPlugins.clear(); | ||
fs_extra_1.default.readdirSync(uniModulesDir).forEach((uniModuleDir) => { | ||
@@ -70,2 +82,3 @@ // 必须以 uni- 开头 | ||
} | ||
extApiPlugins.add(uniModuleDir); | ||
const curInjects = parseInjects(vite, platform, language, `@/uni_modules/${uniModuleDir}`, uniModuleRootDir, exports); | ||
@@ -80,2 +93,17 @@ Object.assign(injects, curInjects); | ||
exports.parseUniExtApis = parseUniExtApis; | ||
function parseUniExtApi(pluginDir, pluginId, vite = true, platform, language = 'javascript') { | ||
const pkgPath = path_1.default.resolve(pluginDir, 'package.json'); | ||
if (!fs_extra_1.default.existsSync(pkgPath)) { | ||
return; | ||
} | ||
let exports; | ||
const pkg = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8')); | ||
if (pkg && pkg.uni_modules && pkg.uni_modules['uni-ext-api']) { | ||
exports = pkg.uni_modules['uni-ext-api']; | ||
} | ||
if (exports) { | ||
return parseInjects(vite, platform, language, `@/uni_modules/${pluginId}`, pluginDir, exports); | ||
} | ||
} | ||
exports.parseUniExtApi = parseUniExtApi; | ||
/** | ||
@@ -123,3 +151,4 @@ * uni:'getBatteryInfo' | ||
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-android')) || | ||
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-ios')); | ||
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-ios')) || | ||
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-harmony')); | ||
} | ||
@@ -130,3 +159,4 @@ } | ||
platform !== 'app-android' && | ||
platform !== 'app-ios') { | ||
platform !== 'app-ios' && | ||
platform !== 'app-harmony') { | ||
if (fs_extra_1.default.existsSync(platformIndexFileName)) { | ||
@@ -139,2 +169,7 @@ source = `${source}/utssdk/${platform}/index.uts`; | ||
} | ||
else if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') { | ||
if (fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-js', 'index.uts'))) { | ||
source = `${source}/utssdk/app-js/index.uts`; | ||
} | ||
} | ||
for (const key in rootDefines) { | ||
@@ -175,3 +210,5 @@ Object.assign(injects, parseInject(vite, platform, language, source, 'uni', rootDefines[key], hasPlatformFile)); | ||
const defineOptions = define[d]; | ||
const p = platform === 'app-android' || platform === 'app-ios' | ||
const p = platform === 'app-android' || | ||
platform === 'app-ios' || | ||
platform === 'app-harmony' | ||
? 'app' | ||
@@ -189,17 +226,11 @@ : platform; | ||
if (isPlainObject(appOptions)) { | ||
if (language === 'javascript') { | ||
if (appOptions.js === false) { | ||
// js engine 下且存在 app-js,不检查 | ||
const skipCheck = process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js' && | ||
source.includes('app-js'); | ||
if (!skipCheck) { | ||
const targetLanguage = language === 'javascript' ? 'js' : language; | ||
if (targetLanguage && appOptions[targetLanguage] === false) { | ||
return; | ||
} | ||
} | ||
else if (language === 'kotlin') { | ||
if (appOptions.kotlin === false) { | ||
return; | ||
} | ||
} | ||
else if (language === 'swift') { | ||
if (appOptions.swift === false) { | ||
return; | ||
} | ||
} | ||
} | ||
@@ -206,0 +237,0 @@ injects[globalObject + '.' + d] = [ |
@@ -9,6 +9,155 @@ const path = require('path') | ||
} = require('./uni_modules') | ||
const { | ||
dataToEsm | ||
} = require('./dataToEsm') | ||
const { | ||
getUniXKotlinCompiler, | ||
getUniXSwiftCompiler, | ||
getChangedFiles, | ||
getUTSPlugins | ||
} = require('./uts-webpack-plugin') | ||
function createUniModulesSyncFilePreprocessor ( | ||
platform, | ||
utsPlatform | ||
) { | ||
const initPreprocessContext = require('../preprocess') | ||
const { | ||
vueContext: preContext | ||
} = initPreprocessContext( | ||
platform, | ||
global.uniPlugin.platforms | ||
) | ||
if (utsPlatform === 'app-android') { | ||
preContext.APP_ANDROID = true | ||
} | ||
if (utsPlatform === 'app-ios') { | ||
preContext.APP_IOS = true | ||
} | ||
const { | ||
preprocess | ||
} = require('@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/preprocess/lib/preprocess') | ||
function preJs (jsCode) { | ||
return preprocess(jsCode, preContext, { | ||
type: 'js' | ||
}) | ||
} | ||
function preHtml (htmlCode) { | ||
return preprocess(htmlCode, preContext, { | ||
type: 'html' | ||
}) | ||
} | ||
return async (content, fileName) => { | ||
const extname = path.extname(fileName) | ||
if (extname === '.json') { | ||
return dataToEsm(JSON.parse(preJs(content)), { | ||
namedExports: true, | ||
preferConst: true | ||
}) | ||
} else if (extname === '.uts' || extname === '.ts') { | ||
return preJs(content) | ||
} else if (extname === '.uvue' || extname === '.vue') { | ||
return preJs(preHtml(content)) | ||
} | ||
return content | ||
} | ||
} | ||
function once (fn, ctx = null) { | ||
let res | ||
return (...args) => { | ||
if (fn) { | ||
res = fn.apply(ctx, args) | ||
fn = null | ||
} | ||
return res | ||
} | ||
} | ||
const createAppAndroidUniModulesSyncFilePreprocessorOnce = once( | ||
() => { | ||
return createUniModulesSyncFilePreprocessor('app', 'app-android') | ||
} | ||
) | ||
const createAppIosUniModulesSyncFilePreprocessorOnce = once( | ||
() => { | ||
return createUniModulesSyncFilePreprocessor('app', 'app-ios') | ||
} | ||
) | ||
module.exports = async function (content) { | ||
const callback = this.async() | ||
const uniXKotlinCompiler = getUniXKotlinCompiler() | ||
const uniXSwiftCompiler = getUniXSwiftCompiler() | ||
const { | ||
syncUniModuleFilesByCompiler, | ||
resolveTscUniModuleIndexFileName | ||
} = resolveUTSCompiler() | ||
const compilePlugin = async (pluginDir) => { | ||
const pluginId = path.basename(pluginDir) | ||
const utsPlugins = getUTSPlugins() | ||
const changedFiles = getChangedFiles() | ||
if (uniXKotlinCompiler) { | ||
await uniXKotlinCompiler.init() | ||
await syncUniModuleFilesByCompiler( | ||
'app-android', | ||
uniXKotlinCompiler, | ||
pluginDir, | ||
createAppAndroidUniModulesSyncFilePreprocessorOnce() | ||
) | ||
} | ||
if (uniXSwiftCompiler) { | ||
await uniXSwiftCompiler.init() | ||
await syncUniModuleFilesByCompiler( | ||
'app-ios', | ||
uniXSwiftCompiler, | ||
pluginDir, | ||
createAppIosUniModulesSyncFilePreprocessorOnce() | ||
) | ||
} | ||
if (!utsPlugins.has(pluginId)) { | ||
utsPlugins.add(pluginId) | ||
if (uniXKotlinCompiler) { | ||
const indexFileName = resolveTscUniModuleIndexFileName( | ||
'app-android', | ||
pluginDir | ||
) | ||
if (indexFileName) { | ||
await uniXKotlinCompiler.addRootFile(indexFileName) | ||
} | ||
} | ||
if (uniXSwiftCompiler) { | ||
const indexFileName = resolveTscUniModuleIndexFileName( | ||
'app-ios', | ||
pluginDir | ||
) | ||
if (indexFileName) { | ||
await uniXSwiftCompiler.addRootFile(indexFileName) | ||
} | ||
} | ||
} | ||
// 处理uni_modules中的文件变更 | ||
const files = changedFiles.get(pluginId) | ||
if (files) { | ||
// 仅限watch模式是会生效 | ||
changedFiles.delete(pluginId) | ||
if (uniXKotlinCompiler) { | ||
await uniXKotlinCompiler.invalidate(files) | ||
} | ||
if (uniXSwiftCompiler) { | ||
await uniXSwiftCompiler.invalidate(files) | ||
} | ||
} | ||
const pkgJson = require(path.join(pluginDir, 'package.json')) | ||
@@ -37,2 +186,5 @@ const compiler = resolveUTSCompiler() | ||
uni_modules: deps | ||
// 暂不提供 | ||
// async kotlinAutoImports() {} | ||
// async swiftAutoImports() {} | ||
}) | ||
@@ -39,0 +191,0 @@ } |
@@ -6,5 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0; | ||
exports.tscOutDir = exports.uvueOutDir = exports.genUniExtApiDeclarationFileOnce = exports.initUTSSwiftAutoImportsOnce = exports.initUTSKotlinAutoImportsOnce = exports.resolveUniTypeScript = exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.getUTSComponentAutoImports = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0; | ||
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts | ||
const fs_1 = __importDefault(require("fs")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -31,3 +31,3 @@ const fast_glob_1 = __importDefault(require("fast-glob")); | ||
*/ | ||
function resolveUTSAppModule(id, importer, includeUTSSDK = true) { | ||
function resolveUTSAppModule(platform, id, importer, includeUTSSDK = true) { | ||
id = path_1.default.resolve(importer, id); | ||
@@ -40,9 +40,25 @@ if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) { | ||
const basedir = parentDir === 'uni_modules' ? 'utssdk' : ''; | ||
if (fs_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) { | ||
if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') { | ||
// js engine | ||
if (parentDir === 'uni_modules') { | ||
const appJsIndex = path_1.default.resolve(id, basedir, 'app-js', 'index.uts'); | ||
if (fs_extra_1.default.existsSync(appJsIndex)) { | ||
return appJsIndex; | ||
} | ||
} | ||
} | ||
if (fs_extra_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) { | ||
return id; | ||
} | ||
const fileName = id.split('?')[0]; | ||
const resolvePlatformDir = (p) => { | ||
return path_1.default.resolve(id, basedir, p); | ||
return path_1.default.resolve(fileName, basedir, p); | ||
}; | ||
const extname = ['.uts']; | ||
const extname = ['.uts', '.vue', '.uvue']; | ||
if (platform === 'app-harmony') { | ||
if (resolveUTSFile(resolvePlatformDir(platform), extname)) { | ||
return id; | ||
} | ||
return; | ||
} | ||
if (resolveUTSFile(resolvePlatformDir('app-android'), extname)) { | ||
@@ -61,4 +77,5 @@ return id; | ||
if (process.env.UNI_PLATFORM === 'app' || | ||
process.env.UNI_PLATFORM === 'app-plus') { | ||
return resolveUTSAppModule(id, importer); | ||
process.env.UNI_PLATFORM === 'app-plus' || | ||
process.env.UNI_PLATFORM === 'app-harmony') { | ||
return resolveUTSAppModule(process.env.UNI_UTS_PLATFORM, id, importer); | ||
} | ||
@@ -80,3 +97,3 @@ id = path_1.default.resolve(importer, id); | ||
index = path_1.default.resolve(id, basedir, 'index.uts'); | ||
if (fs_1.default.existsSync(index)) { | ||
if (fs_extra_1.default.existsSync(index)) { | ||
return index; | ||
@@ -91,3 +108,3 @@ } | ||
const indexFile = path_1.default.join(dir, 'index' + extensions[i]); | ||
if (fs_1.default.existsSync(indexFile)) { | ||
if (fs_extra_1.default.existsSync(indexFile)) { | ||
return indexFile; | ||
@@ -108,3 +125,3 @@ } | ||
compilerPath = require.resolve('@dcloudio/uni-uts-v1', { | ||
paths: [process.env.UNI_CLI_CONTEXT], | ||
paths: [process.env.UNI_CLI_CONTEXT || process.cwd()], | ||
}); | ||
@@ -139,2 +156,19 @@ } | ||
exports.isUTSComponent = isUTSComponent; | ||
function getUTSComponentAutoImports(language) { | ||
const utsComponentAutoImports = {}; | ||
utsComponents.forEach(({ kotlinPackage, swiftModule }, name) => { | ||
const source = language === 'kotlin' ? kotlinPackage : swiftModule; | ||
const className = (0, utils_1.capitalize)((0, utils_1.camelize)(name)) + 'Element'; | ||
if (!utsComponentAutoImports[source]) { | ||
utsComponentAutoImports[source] = [[className]]; | ||
} | ||
else { | ||
if (!utsComponentAutoImports[source].find((item) => item[0] === className)) { | ||
utsComponentAutoImports[source].push([className]); | ||
} | ||
} | ||
}); | ||
return utsComponentAutoImports; | ||
} | ||
exports.getUTSComponentAutoImports = getUTSComponentAutoImports; | ||
function parseUTSComponent(name, type) { | ||
@@ -179,5 +213,8 @@ const meta = utsComponents.get(name); | ||
if (name) { | ||
const importDir = (0, utils_1.normalizePath)(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir); | ||
const source = '@/' + | ||
(0, utils_1.normalizePath)(isApp | ||
? path_1.default.relative(inputDir, is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir) | ||
: path_1.default.relative(inputDir, file)); | ||
easycomsObj[`^${name}$`] = { | ||
source: isApp ? `${importDir}?uts-proxy` : (0, utils_1.normalizePath)(file), | ||
source: isApp ? `${source}?uts-proxy` : source, | ||
kotlinPackage: parseKotlinPackageWithPluginId(pluginId, is_uni_modules_utssdk), | ||
@@ -224,3 +261,3 @@ swiftModule: parseSwiftPackageWithPluginId(pluginId, is_uni_modules_utssdk), | ||
function parseVueComponentName(file) { | ||
const content = fs_1.default.readFileSync(file, 'utf8'); | ||
const content = fs_extra_1.default.readFileSync(file, 'utf8'); | ||
const matches = content.match(nameRE); | ||
@@ -248,2 +285,50 @@ if (matches) { | ||
exports.parseSwiftPackageWithPluginId = parseSwiftPackageWithPluginId; | ||
async function parseUniExtApiAutoImports(uniExtApiAutoImports, extApis, parseSource) { | ||
if (Object.keys(extApis).length) { | ||
const { parseExportIdentifiers } = resolveUTSCompiler(); | ||
for (const name in extApis) { | ||
const options = extApis[name]; | ||
if ((0, utils_1.isArray)(options) && options.length >= 2) { | ||
const pluginId = path_1.default.basename(options[0]); | ||
const source = parseSource(pluginId); | ||
if (uniExtApiAutoImports[source]) { | ||
continue; | ||
} | ||
uniExtApiAutoImports[source] = []; | ||
const filename = `uni_modules/${pluginId}/utssdk/interface.uts`; | ||
const interfaceFileName = path_1.default.resolve(process.env.UNI_INPUT_DIR, filename); | ||
if (fs_extra_1.default.existsSync(interfaceFileName)) { | ||
const ids = await parseExportIdentifiers(interfaceFileName); | ||
ids | ||
// 过滤掉 Uni | ||
.filter((id) => id !== 'Uni') | ||
.forEach((id) => { | ||
uniExtApiAutoImports[source].push([id]); | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
return uniExtApiAutoImports; | ||
} | ||
let uniExtApiKotlinAutoImports = null; | ||
async function parseUniExtApiKotlinAutoImportsOnce(extApis) { | ||
if (uniExtApiKotlinAutoImports) { | ||
return uniExtApiKotlinAutoImports; | ||
} | ||
uniExtApiKotlinAutoImports = {}; | ||
return parseUniExtApiAutoImports(uniExtApiKotlinAutoImports, extApis, (pluginId) => { | ||
return parseKotlinPackageWithPluginId(pluginId, true); | ||
}); | ||
} | ||
let uniExtApiSwiftAutoImports = null; | ||
async function parseUniExtApiSwiftAutoImportsOnce(extApis) { | ||
if (uniExtApiSwiftAutoImports) { | ||
return uniExtApiSwiftAutoImports; | ||
} | ||
uniExtApiSwiftAutoImports = {}; | ||
return parseUniExtApiAutoImports(uniExtApiSwiftAutoImports, extApis, (pluginId) => { | ||
return parseSwiftPackageWithPluginId(pluginId, true); | ||
}); | ||
} | ||
exports.parseUniExtApiNamespacesOnce = once((platform, language) => { | ||
@@ -277,1 +362,87 @@ const extApis = (0, exports.parseUniExtApiNamespacesJsOnce)(platform, language); | ||
}); | ||
function resolveUniTypeScript() { | ||
if ((0, hbx_1.isInHBuilderX)()) { | ||
return require(path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'uniapp-uts-v1', 'node_modules', '@dcloudio', 'uni-uts-v1', 'lib', 'typescript')); | ||
} | ||
return require('@dcloudio/uni-uts-v1/lib/typescript'); | ||
} | ||
exports.resolveUniTypeScript = resolveUniTypeScript; | ||
async function initUTSAutoImports(autoImports, platform, language) { | ||
const utsComponents = getUTSComponentAutoImports(language); | ||
Object.keys(utsComponents).forEach((source) => { | ||
if (autoImports[source]) { | ||
autoImports[source].push(...utsComponents[source]); | ||
} | ||
else { | ||
autoImports[source] = utsComponents[source]; | ||
} | ||
}); | ||
const extApis = (0, uni_modules_1.parseUniExtApis)(true, platform, language); | ||
const extApiImports = await (language === 'kotlin' | ||
? parseUniExtApiKotlinAutoImportsOnce | ||
: parseUniExtApiSwiftAutoImportsOnce)(extApis); | ||
Object.keys(extApiImports).forEach((source) => { | ||
if (autoImports[source]) { | ||
autoImports[source].push(...extApiImports[source]); | ||
} | ||
else { | ||
autoImports[source] = extApiImports[source]; | ||
} | ||
}); | ||
return autoImports; | ||
} | ||
let autoKotlinImports = null; | ||
async function initUTSKotlinAutoImportsOnce() { | ||
if (autoKotlinImports) { | ||
return autoKotlinImports; | ||
} | ||
autoKotlinImports = {}; | ||
return initUTSAutoImports(autoKotlinImports, 'app-android', 'kotlin'); | ||
} | ||
exports.initUTSKotlinAutoImportsOnce = initUTSKotlinAutoImportsOnce; | ||
let autoSwiftImports = null; | ||
async function initUTSSwiftAutoImportsOnce() { | ||
if (autoSwiftImports) { | ||
return autoSwiftImports; | ||
} | ||
autoSwiftImports = {}; | ||
return initUTSAutoImports(autoSwiftImports, 'app-ios', 'swift'); | ||
} | ||
exports.initUTSSwiftAutoImportsOnce = initUTSSwiftAutoImportsOnce; | ||
exports.genUniExtApiDeclarationFileOnce = once((tscInputDir) => { | ||
const extApis = (0, uni_modules_1.parseUniExtApis)(true, 'app-android', 'kotlin'); | ||
// 之所以往上一级写,是因为 tscInputDir 会被 empty,目前时机有问题,比如先生成了d.ts,又被empty | ||
const fileName = path_1.default.resolve(tscInputDir, '../uni-ext-api.d.ts'); | ||
if (fs_extra_1.default.existsSync(fileName)) { | ||
try { | ||
// 先删除 | ||
fs_extra_1.default.unlinkSync(fileName); | ||
} | ||
catch (e) { } | ||
} | ||
if (Object.keys(extApis).length) { | ||
const apis = []; | ||
for (const name in extApis) { | ||
const options = extApis[name]; | ||
if ((0, utils_1.isArray)(options) && options.length >= 2) { | ||
const api = name.replace('uni.', ''); | ||
apis.push(' ' + api + `: typeof import("${options[0]}")["${options[1]}"]`); | ||
} | ||
} | ||
if (apis.length) { | ||
fs_extra_1.default.outputFileSync(fileName, ` | ||
interface Uni { | ||
${apis.join('\n')} | ||
} | ||
`); | ||
} | ||
} | ||
}); | ||
function uvueOutDir(platform) { | ||
return path_1.default.join(process.env.UNI_APP_X_UVUE_DIR, platform); | ||
} | ||
exports.uvueOutDir = uvueOutDir; | ||
function tscOutDir(platform) { | ||
return path_1.default.join(process.env.UNI_APP_X_TSC_DIR, platform); | ||
} | ||
exports.tscOutDir = tscOutDir; |
{ | ||
"name": "@dcloudio/uni-cli-shared", | ||
"version": "2.0.2-alpha-4020920240929001", | ||
"version": "2.0.2-alpha-4030120241010001", | ||
"description": "uni-cli-shared", | ||
@@ -24,2 +24,3 @@ "main": "lib/index.js", | ||
"fast-glob": "^3.2.11", | ||
"fs-extra": "^10.0.0", | ||
"glob-escape": "^0.0.2", | ||
@@ -30,3 +31,3 @@ "hash-sum": "^1.0.2", | ||
}, | ||
"gitHead": "597645e8677412c8ad3fc7d995ca58371c07a82d" | ||
"gitHead": "57a91f414fe40a29a7ff4dacc3a30612cba94e70" | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
811892
72
5867
7
189
+ Addedfs-extra@^10.0.0
+ Addedfs-extra@10.1.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addeduniversalify@2.0.1(transitive)