XuqmGroup-H5SDK/node_modules/@rushstack/rig-package/lib-esm/Helpers.js
徐勤民 e34fa2052a feat(private): add private deployment SDK module
Adds @xuqm/h5-sdk/private entry point with JSON-based initialization,
feature gating, and error codes for private deployment scenarios.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 21:08:08 +08:00

41 行
1.4 KiB
JavaScript

// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import * as path from 'node:path';
import * as fs from 'node:fs';
import nodeResolve from 'resolve';
// These helpers avoid taking dependencies on other NPM packages
export class Helpers {
static async nodeResolveAsync(id, opts) {
return await new Promise((resolve, reject) => {
nodeResolve(id, opts, (error, result) => {
if (error) {
reject(error);
}
else {
resolve(result);
}
});
});
}
static async fsExistsAsync(filesystemPath) {
return await new Promise((resolve) => {
fs.exists(filesystemPath, (exists) => {
resolve(exists);
});
});
}
// Based on Path.isDownwardRelative() from @rushstack/node-core-library
static isDownwardRelative(inputPath) {
if (path.isAbsolute(inputPath)) {
return false;
}
// Does it contain ".."
if (Helpers._upwardPathSegmentRegex.test(inputPath)) {
return false;
}
return true;
}
}
// Based on Path.isDownwardRelative() from @rushstack/node-core-library
Helpers._upwardPathSegmentRegex = /([\/\\]|^)\.\.([\/\\]|$)/;
//# sourceMappingURL=Helpers.js.map