@salesforce/core 8.31.4 → 8.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/fs/fs.js +2 -2
- package/lib/global.js +2 -1
- package/lib/util/isWeb.d.ts +1 -0
- package/lib/util/isWeb.js +16 -0
- package/package.json +1 -1
package/lib/fs/fs.js
CHANGED
|
@@ -34,9 +34,9 @@ const nodeFs = __importStar(require("node:fs"));
|
|
|
34
34
|
// yes, we're going to import it even though it might not be used.
|
|
35
35
|
// the alternatives were all worse without top-level await (iife, runtime errors from something trying to use it before it's initialized)
|
|
36
36
|
const memfs = __importStar(require("memfs"));
|
|
37
|
-
const
|
|
37
|
+
const isWeb_1 = require("../util/isWeb");
|
|
38
38
|
const getVirtualFs = (memfsVolume) => {
|
|
39
|
-
if (isWeb()) {
|
|
39
|
+
if (process.env.FORCE_MEMFS === 'true' || (0, isWeb_1.isWeb)()) {
|
|
40
40
|
const memfsInstance = memfs.createFsFromVolume(memfsVolume ?? new memfs.Volume());
|
|
41
41
|
// Start with memfs instance and only override problematic methods
|
|
42
42
|
const webFs = {
|
package/lib/global.js
CHANGED
|
@@ -34,6 +34,7 @@ const os = __importStar(require("node:os"));
|
|
|
34
34
|
const path = __importStar(require("node:path"));
|
|
35
35
|
const kit_1 = require("@salesforce/kit");
|
|
36
36
|
const fs_1 = require("./fs/fs");
|
|
37
|
+
const isWeb_1 = require("./util/isWeb");
|
|
37
38
|
const sfError_1 = require("./sfError");
|
|
38
39
|
/**
|
|
39
40
|
* Represents an environment mode. Supports `production`, `development`, `demo`, and `test`
|
|
@@ -74,7 +75,7 @@ class Global {
|
|
|
74
75
|
* Whether the code is running in a web browser.
|
|
75
76
|
*/
|
|
76
77
|
static get isWeb() {
|
|
77
|
-
return
|
|
78
|
+
return (0, isWeb_1.isWeb)();
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
81
|
* The full system path to the global sfdx state folder.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isWeb: () => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.isWeb = void 0;
|
|
10
|
+
const isWeb = () => {
|
|
11
|
+
if (process.versions.bun)
|
|
12
|
+
return false;
|
|
13
|
+
return 'window' in globalThis || 'self' in globalThis;
|
|
14
|
+
};
|
|
15
|
+
exports.isWeb = isWeb;
|
|
16
|
+
//# sourceMappingURL=isWeb.js.map
|