@salesforce/core 8.8.3 → 8.8.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.
@@ -143,7 +143,7 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
143
143
  this.aliasStore = fileContentsRawToAliasStore(await (0, promises_1.readFile)(this.fileLocation, 'utf-8'));
144
144
  }
145
145
  catch (e) {
146
- if (e instanceof Error && 'code' in e && e.code === 'ENOENT') {
146
+ if (e instanceof Error && 'code' in e && typeof e.code === 'string' && ['ENOENT', 'ENOTDIR'].includes(e.code)) {
147
147
  this.aliasStore = new Map();
148
148
  await (0, promises_1.mkdir)((0, node_path_1.dirname)(this.fileLocation), { recursive: true });
149
149
  await this.saveAliasStoreToFile();
@@ -55,14 +55,7 @@ const lockInit = async (filePath) => {
55
55
  catch (err) {
56
56
  throw sfError_1.SfError.wrap(err);
57
57
  }
58
- const [unlock] = await Promise.all(fs.existsSync(filePath)
59
- ? // if the file exists, wait for it to be unlocked
60
- [(0, proper_lockfile_1.lock)(filePath, lockRetryOptions_1.lockRetryOptions)]
61
- : // lock the entire directory to keep others from trying to create the file while we are
62
- [
63
- (0, proper_lockfile_1.lock)((0, node_path_1.dirname)(filePath), lockRetryOptions_1.lockRetryOptions),
64
- (await logger_1.Logger.child('fileLocking.lockInit')).debug(`No file found at ${filePath}. Write will create it. Locking the entire directory until file is written.`),
65
- ]);
58
+ const unlock = await (0, proper_lockfile_1.lock)(filePath, { ...lockRetryOptions_1.lockRetryOptions, realpath: false });
66
59
  return {
67
60
  writeAndUnlock: async (data) => {
68
61
  const logger = await logger_1.Logger.child('fileLocking.writeAndUnlock');
@@ -90,14 +83,7 @@ const lockInitSync = (filePath) => {
90
83
  catch (err) {
91
84
  throw sfError_1.SfError.wrap(err);
92
85
  }
93
- const [unlock] = fs.existsSync(filePath)
94
- ? // if the file exists, wait for it to be unlocked
95
- [(0, proper_lockfile_1.lockSync)(filePath, lockRetryOptions_1.lockOptions)]
96
- : // lock the entire directory to keep others from trying to create the file while we are
97
- [
98
- (0, proper_lockfile_1.lockSync)((0, node_path_1.dirname)(filePath), lockRetryOptions_1.lockOptions),
99
- logger_1.Logger.childFromRoot('fileLocking.lockInit').debug(`No file found at ${filePath}. Write will create it. Locking the entire directory until file is written.`),
100
- ];
86
+ const unlock = (0, proper_lockfile_1.lockSync)(filePath, { ...lockRetryOptions_1.lockOptions, realpath: false });
101
87
  return {
102
88
  writeAndUnlock: (data) => {
103
89
  const logger = logger_1.Logger.childFromRoot('fileLocking.writeAndUnlock');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.8.3",
3
+ "version": "8.8.5",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",