react-native-platform-override 1.9.21 → 1.9.22
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-commonjs/Api.d.ts +57 -57
- package/lib-commonjs/Api.js +187 -187
- package/lib-commonjs/BatchingQueue.d.ts +15 -15
- package/lib-commonjs/BatchingQueue.js +57 -57
- package/lib-commonjs/Cli.d.ts +7 -7
- package/lib-commonjs/Cli.js +323 -323
- package/lib-commonjs/CrossProcessLock.d.ts +44 -44
- package/lib-commonjs/CrossProcessLock.js +147 -147
- package/lib-commonjs/DiffStrategy.d.ts +24 -24
- package/lib-commonjs/DiffStrategy.js +34 -34
- package/lib-commonjs/FileRepository.d.ts +62 -62
- package/lib-commonjs/FileRepository.js +21 -21
- package/lib-commonjs/FileSearch.d.ts +21 -21
- package/lib-commonjs/FileSearch.js +77 -77
- package/lib-commonjs/FileSystemRepository.d.ts +20 -20
- package/lib-commonjs/FileSystemRepository.js +62 -62
- package/lib-commonjs/GitReactFileRepository.d.ts +56 -56
- package/lib-commonjs/GitReactFileRepository.js +202 -202
- package/lib-commonjs/Hash.d.ts +33 -33
- package/lib-commonjs/Hash.js +81 -81
- package/lib-commonjs/Manifest.d.ts +80 -80
- package/lib-commonjs/Manifest.js +157 -157
- package/lib-commonjs/Override.d.ts +182 -182
- package/lib-commonjs/Override.js +248 -248
- package/lib-commonjs/OverrideFactory.d.ts +33 -33
- package/lib-commonjs/OverrideFactory.js +85 -85
- package/lib-commonjs/OverridePrompt.d.ts +30 -30
- package/lib-commonjs/OverridePrompt.js +130 -130
- package/lib-commonjs/PackageUtils.d.ts +15 -15
- package/lib-commonjs/PackageUtils.js +40 -40
- package/lib-commonjs/PathUtils.d.ts +14 -14
- package/lib-commonjs/PathUtils.js +31 -31
- package/lib-commonjs/Serialized.d.ts +158 -158
- package/lib-commonjs/Serialized.js +145 -145
- package/lib-commonjs/UpgradeStrategy.d.ts +39 -39
- package/lib-commonjs/UpgradeStrategy.js +102 -102
- package/lib-commonjs/ValidationStrategy.d.ts +57 -57
- package/lib-commonjs/ValidationStrategy.js +124 -124
- package/lib-commonjs/refFromVersion.d.ts +10 -10
- package/lib-commonjs/refFromVersion.js +98 -98
- package/lib-commonjs/refFromVersion.js.map +1 -1
- package/lib-commonjs/scripts/generateManifest.d.ts +7 -7
- package/lib-commonjs/scripts/generateManifest.js +196 -196
- package/lib-commonjs/scripts/hashFile.d.ts +7 -7
- package/lib-commonjs/scripts/hashFile.js +17 -17
- package/lib-commonjs/scripts/testLocks.d.ts +1 -1
- package/lib-commonjs/scripts/testLocks.js +29 -29
- package/package.json +10 -10
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* CrossProcessLock implements a non-polling cross-process asynchronous barrier.
|
|
9
|
-
*
|
|
10
|
-
* - The lock is acquired by creating a named pipe
|
|
11
|
-
*
|
|
12
|
-
* - If named pipe creation fails due to an existing pipe, the process
|
|
13
|
-
* subscribes to the pipe, waiting asynchronously until it dies.
|
|
14
|
-
*
|
|
15
|
-
* - Once the pipe dies, any subscribers will race to acquire the lock (create
|
|
16
|
-
* the pipe server)
|
|
17
|
-
*/
|
|
18
|
-
export default class CrossProcessLock {
|
|
19
|
-
private readonly ipcPath;
|
|
20
|
-
private readonly server;
|
|
21
|
-
private readonly connections;
|
|
22
|
-
/**
|
|
23
|
-
* Create the lock instance. Does not yet allocate any resources.
|
|
24
|
-
*
|
|
25
|
-
* @param lockName unique name of the shared resource. Must be under 256
|
|
26
|
-
* chars and not use special characters.
|
|
27
|
-
*/
|
|
28
|
-
constructor(lockName: string);
|
|
29
|
-
/**
|
|
30
|
-
* Try to acquire the shared resource. Returns false if it is already in use
|
|
31
|
-
* without acquiring the resource. Subsequent tryLock calls after obtaining a
|
|
32
|
-
* lock will return false.
|
|
33
|
-
*/
|
|
34
|
-
tryLock(): Promise<boolean>;
|
|
35
|
-
/**
|
|
36
|
-
* Acquire the shared resource, waiting for it to be available.
|
|
37
|
-
*/
|
|
38
|
-
lock(): Promise<void>;
|
|
39
|
-
private waitUntilPipeDeath;
|
|
40
|
-
/**
|
|
41
|
-
* Release the shared resource
|
|
42
|
-
*/
|
|
43
|
-
unlock(): Promise<void>;
|
|
44
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* CrossProcessLock implements a non-polling cross-process asynchronous barrier.
|
|
9
|
+
*
|
|
10
|
+
* - The lock is acquired by creating a named pipe
|
|
11
|
+
*
|
|
12
|
+
* - If named pipe creation fails due to an existing pipe, the process
|
|
13
|
+
* subscribes to the pipe, waiting asynchronously until it dies.
|
|
14
|
+
*
|
|
15
|
+
* - Once the pipe dies, any subscribers will race to acquire the lock (create
|
|
16
|
+
* the pipe server)
|
|
17
|
+
*/
|
|
18
|
+
export default class CrossProcessLock {
|
|
19
|
+
private readonly ipcPath;
|
|
20
|
+
private readonly server;
|
|
21
|
+
private readonly connections;
|
|
22
|
+
/**
|
|
23
|
+
* Create the lock instance. Does not yet allocate any resources.
|
|
24
|
+
*
|
|
25
|
+
* @param lockName unique name of the shared resource. Must be under 256
|
|
26
|
+
* chars and not use special characters.
|
|
27
|
+
*/
|
|
28
|
+
constructor(lockName: string);
|
|
29
|
+
/**
|
|
30
|
+
* Try to acquire the shared resource. Returns false if it is already in use
|
|
31
|
+
* without acquiring the resource. Subsequent tryLock calls after obtaining a
|
|
32
|
+
* lock will return false.
|
|
33
|
+
*/
|
|
34
|
+
tryLock(): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Acquire the shared resource, waiting for it to be available.
|
|
37
|
+
*/
|
|
38
|
+
lock(): Promise<void>;
|
|
39
|
+
private waitUntilPipeDeath;
|
|
40
|
+
/**
|
|
41
|
+
* Release the shared resource
|
|
42
|
+
*/
|
|
43
|
+
unlock(): Promise<void>;
|
|
44
|
+
}
|
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* @format
|
|
7
|
-
*/
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const net_1 = __importDefault(require("net"));
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const os_1 = require("os");
|
|
15
|
-
/**
|
|
16
|
-
* CrossProcessLock implements a non-polling cross-process asynchronous barrier.
|
|
17
|
-
*
|
|
18
|
-
* - The lock is acquired by creating a named pipe
|
|
19
|
-
*
|
|
20
|
-
* - If named pipe creation fails due to an existing pipe, the process
|
|
21
|
-
* subscribes to the pipe, waiting asynchronously until it dies.
|
|
22
|
-
*
|
|
23
|
-
* - Once the pipe dies, any subscribers will race to acquire the lock (create
|
|
24
|
-
* the pipe server)
|
|
25
|
-
*/
|
|
26
|
-
class CrossProcessLock {
|
|
27
|
-
/**
|
|
28
|
-
* Create the lock instance. Does not yet allocate any resources.
|
|
29
|
-
*
|
|
30
|
-
* @param lockName unique name of the shared resource. Must be under 256
|
|
31
|
-
* chars and not use special characters.
|
|
32
|
-
*/
|
|
33
|
-
constructor(lockName) {
|
|
34
|
-
if ((0, os_1.platform)() === 'win32') {
|
|
35
|
-
this.ipcPath = `\\\\.\\pipe\\${lockName}`;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
this.ipcPath = path_1.default.join((0, os_1.tmpdir)(), `${lockName}`);
|
|
39
|
-
}
|
|
40
|
-
this.server = net_1.default.createServer();
|
|
41
|
-
this.connections = new Set();
|
|
42
|
-
this.server.on('connection', conn => {
|
|
43
|
-
this.connections.add(conn);
|
|
44
|
-
conn.on('close', () => this.connections.delete(conn));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Try to acquire the shared resource. Returns false if it is already in use
|
|
49
|
-
* without acquiring the resource. Subsequent tryLock calls after obtaining a
|
|
50
|
-
* lock will return false.
|
|
51
|
-
*/
|
|
52
|
-
tryLock() {
|
|
53
|
-
if (this.server.listening) {
|
|
54
|
-
return Promise.resolve(false);
|
|
55
|
-
}
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
const onListening = () => {
|
|
58
|
-
this.server.off('error', onError);
|
|
59
|
-
resolve(true);
|
|
60
|
-
};
|
|
61
|
-
const onError = (err) => {
|
|
62
|
-
this.server.off('listening', onListening);
|
|
63
|
-
// @ts-ignore Typings for EventEmitter only know about generic JS errors
|
|
64
|
-
if (err.code === 'EADDRINUSE') {
|
|
65
|
-
resolve(false);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
reject(err);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
this.server.once('listening', onListening);
|
|
72
|
-
this.server.once('error', onError);
|
|
73
|
-
try {
|
|
74
|
-
this.server.listen({
|
|
75
|
-
path: this.ipcPath,
|
|
76
|
-
exclusive: true,
|
|
77
|
-
readableAll: true,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
catch (ex) {
|
|
81
|
-
// Old versions of Node will throw an extra TypeError when address is
|
|
82
|
-
// in use that we need to ignore https://github.com/nodejs/node/issues/23917
|
|
83
|
-
if (ex.name !== 'TypeError') {
|
|
84
|
-
throw ex;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Acquire the shared resource, waiting for it to be available.
|
|
91
|
-
*/
|
|
92
|
-
async lock() {
|
|
93
|
-
if (this.server.listening) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (!(await this.tryLock())) {
|
|
97
|
-
await this.waitUntilPipeDeath();
|
|
98
|
-
return this.lock();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
waitUntilPipeDeath() {
|
|
102
|
-
return new Promise((resolve, reject) => {
|
|
103
|
-
const socket = new net_1.default.Socket();
|
|
104
|
-
// Treat some errors as potential pipe death, since it could have died
|
|
105
|
-
// between the time to create a server and attempting to connect to the
|
|
106
|
-
// existing.
|
|
107
|
-
socket.once('error', err => {
|
|
108
|
-
// @ts-ignore Typings for EventEmitter only know about generic JS errors
|
|
109
|
-
if (err.code === 'ECONNREFUSED' || err.code === 'ECONNRESET') {
|
|
110
|
-
resolve();
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
reject(err);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
socket.once('close', () => resolve());
|
|
117
|
-
socket.setTimeout(0);
|
|
118
|
-
socket.connect({ path: this.ipcPath });
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Release the shared resource
|
|
123
|
-
*/
|
|
124
|
-
unlock() {
|
|
125
|
-
if (!this.server.listening) {
|
|
126
|
-
return Promise.resolve();
|
|
127
|
-
}
|
|
128
|
-
return new Promise((resolve, reject) => {
|
|
129
|
-
const onClose = () => {
|
|
130
|
-
this.server.off('error', onError);
|
|
131
|
-
resolve();
|
|
132
|
-
};
|
|
133
|
-
const onError = (err) => {
|
|
134
|
-
this.server.off('close', onClose);
|
|
135
|
-
reject(err);
|
|
136
|
-
};
|
|
137
|
-
this.server.once('close', onClose);
|
|
138
|
-
this.server.once('error', onError);
|
|
139
|
-
// Closing will only prevent new connections, instead of killing old
|
|
140
|
-
// ones. Manually destroy all existing connections to let them retry the
|
|
141
|
-
// lock.
|
|
142
|
-
this.server.close();
|
|
143
|
-
this.connections.forEach(conn => conn.destroy());
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.default = CrossProcessLock;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*
|
|
6
|
+
* @format
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const net_1 = __importDefault(require("net"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const os_1 = require("os");
|
|
15
|
+
/**
|
|
16
|
+
* CrossProcessLock implements a non-polling cross-process asynchronous barrier.
|
|
17
|
+
*
|
|
18
|
+
* - The lock is acquired by creating a named pipe
|
|
19
|
+
*
|
|
20
|
+
* - If named pipe creation fails due to an existing pipe, the process
|
|
21
|
+
* subscribes to the pipe, waiting asynchronously until it dies.
|
|
22
|
+
*
|
|
23
|
+
* - Once the pipe dies, any subscribers will race to acquire the lock (create
|
|
24
|
+
* the pipe server)
|
|
25
|
+
*/
|
|
26
|
+
class CrossProcessLock {
|
|
27
|
+
/**
|
|
28
|
+
* Create the lock instance. Does not yet allocate any resources.
|
|
29
|
+
*
|
|
30
|
+
* @param lockName unique name of the shared resource. Must be under 256
|
|
31
|
+
* chars and not use special characters.
|
|
32
|
+
*/
|
|
33
|
+
constructor(lockName) {
|
|
34
|
+
if ((0, os_1.platform)() === 'win32') {
|
|
35
|
+
this.ipcPath = `\\\\.\\pipe\\${lockName}`;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.ipcPath = path_1.default.join((0, os_1.tmpdir)(), `${lockName}`);
|
|
39
|
+
}
|
|
40
|
+
this.server = net_1.default.createServer();
|
|
41
|
+
this.connections = new Set();
|
|
42
|
+
this.server.on('connection', conn => {
|
|
43
|
+
this.connections.add(conn);
|
|
44
|
+
conn.on('close', () => this.connections.delete(conn));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Try to acquire the shared resource. Returns false if it is already in use
|
|
49
|
+
* without acquiring the resource. Subsequent tryLock calls after obtaining a
|
|
50
|
+
* lock will return false.
|
|
51
|
+
*/
|
|
52
|
+
tryLock() {
|
|
53
|
+
if (this.server.listening) {
|
|
54
|
+
return Promise.resolve(false);
|
|
55
|
+
}
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
const onListening = () => {
|
|
58
|
+
this.server.off('error', onError);
|
|
59
|
+
resolve(true);
|
|
60
|
+
};
|
|
61
|
+
const onError = (err) => {
|
|
62
|
+
this.server.off('listening', onListening);
|
|
63
|
+
// @ts-ignore Typings for EventEmitter only know about generic JS errors
|
|
64
|
+
if (err.code === 'EADDRINUSE') {
|
|
65
|
+
resolve(false);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
reject(err);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
this.server.once('listening', onListening);
|
|
72
|
+
this.server.once('error', onError);
|
|
73
|
+
try {
|
|
74
|
+
this.server.listen({
|
|
75
|
+
path: this.ipcPath,
|
|
76
|
+
exclusive: true,
|
|
77
|
+
readableAll: true,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (ex) {
|
|
81
|
+
// Old versions of Node will throw an extra TypeError when address is
|
|
82
|
+
// in use that we need to ignore https://github.com/nodejs/node/issues/23917
|
|
83
|
+
if (ex.name !== 'TypeError') {
|
|
84
|
+
throw ex;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Acquire the shared resource, waiting for it to be available.
|
|
91
|
+
*/
|
|
92
|
+
async lock() {
|
|
93
|
+
if (this.server.listening) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (!(await this.tryLock())) {
|
|
97
|
+
await this.waitUntilPipeDeath();
|
|
98
|
+
return this.lock();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
waitUntilPipeDeath() {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
const socket = new net_1.default.Socket();
|
|
104
|
+
// Treat some errors as potential pipe death, since it could have died
|
|
105
|
+
// between the time to create a server and attempting to connect to the
|
|
106
|
+
// existing.
|
|
107
|
+
socket.once('error', err => {
|
|
108
|
+
// @ts-ignore Typings for EventEmitter only know about generic JS errors
|
|
109
|
+
if (err.code === 'ECONNREFUSED' || err.code === 'ECONNRESET') {
|
|
110
|
+
resolve();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
reject(err);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
socket.once('close', () => resolve());
|
|
117
|
+
socket.setTimeout(0);
|
|
118
|
+
socket.connect({ path: this.ipcPath });
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Release the shared resource
|
|
123
|
+
*/
|
|
124
|
+
unlock() {
|
|
125
|
+
if (!this.server.listening) {
|
|
126
|
+
return Promise.resolve();
|
|
127
|
+
}
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
const onClose = () => {
|
|
130
|
+
this.server.off('error', onError);
|
|
131
|
+
resolve();
|
|
132
|
+
};
|
|
133
|
+
const onError = (err) => {
|
|
134
|
+
this.server.off('close', onClose);
|
|
135
|
+
reject(err);
|
|
136
|
+
};
|
|
137
|
+
this.server.once('close', onClose);
|
|
138
|
+
this.server.once('error', onError);
|
|
139
|
+
// Closing will only prevent new connections, instead of killing old
|
|
140
|
+
// ones. Manually destroy all existing connections to let them retry the
|
|
141
|
+
// lock.
|
|
142
|
+
this.server.close();
|
|
143
|
+
this.connections.forEach(conn => conn.destroy());
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.default = CrossProcessLock;
|
|
148
148
|
//# sourceMappingURL=CrossProcessLock.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
import GitReactFileRepository from './GitReactFileRepository';
|
|
8
|
-
import { WritableFileRepository } from './FileRepository';
|
|
9
|
-
/**
|
|
10
|
-
* An UpgradeStrategy describes the process to diff an override to its base
|
|
11
|
-
*/
|
|
12
|
-
export default interface DiffStrategy {
|
|
13
|
-
diff(gitReactRepo: GitReactFileRepository, overrideRepo: WritableFileRepository): Promise<string>;
|
|
14
|
-
}
|
|
15
|
-
export declare const DiffStrategies: {
|
|
16
|
-
/**
|
|
17
|
-
* Assume the override is the same as the original
|
|
18
|
-
*/
|
|
19
|
-
assumeSame: () => DiffStrategy;
|
|
20
|
-
/**
|
|
21
|
-
* Assume the override is the same as the original
|
|
22
|
-
*/
|
|
23
|
-
compareBaseFile: (overrideFile: string, baseFile: string, baseVersion: string) => DiffStrategy;
|
|
24
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
import GitReactFileRepository from './GitReactFileRepository';
|
|
8
|
+
import { WritableFileRepository } from './FileRepository';
|
|
9
|
+
/**
|
|
10
|
+
* An UpgradeStrategy describes the process to diff an override to its base
|
|
11
|
+
*/
|
|
12
|
+
export default interface DiffStrategy {
|
|
13
|
+
diff(gitReactRepo: GitReactFileRepository, overrideRepo: WritableFileRepository): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
export declare const DiffStrategies: {
|
|
16
|
+
/**
|
|
17
|
+
* Assume the override is the same as the original
|
|
18
|
+
*/
|
|
19
|
+
assumeSame: () => DiffStrategy;
|
|
20
|
+
/**
|
|
21
|
+
* Assume the override is the same as the original
|
|
22
|
+
*/
|
|
23
|
+
compareBaseFile: (overrideFile: string, baseFile: string, baseVersion: string) => DiffStrategy;
|
|
24
|
+
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* @format
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DiffStrategies = void 0;
|
|
10
|
-
exports.DiffStrategies = {
|
|
11
|
-
/**
|
|
12
|
-
* Assume the override is the same as the original
|
|
13
|
-
*/
|
|
14
|
-
assumeSame: () => ({
|
|
15
|
-
diff: async () => '',
|
|
16
|
-
}),
|
|
17
|
-
/**
|
|
18
|
-
* Assume the override is the same as the original
|
|
19
|
-
*/
|
|
20
|
-
compareBaseFile: (overrideFile, baseFile, baseVersion) => ({
|
|
21
|
-
diff: async (gitReactRepo, overrideRepo) => {
|
|
22
|
-
const overrideContents = await overrideRepo.readFile(overrideFile);
|
|
23
|
-
if (!overrideContents) {
|
|
24
|
-
throw new Error(`Couldn't read override "${overrideFile}"`);
|
|
25
|
-
}
|
|
26
|
-
const patch = await gitReactRepo.generatePatch(baseFile, baseVersion, overrideContents);
|
|
27
|
-
return patch
|
|
28
|
-
.trim()
|
|
29
|
-
.split('\n')
|
|
30
|
-
.slice(4) // Ignore Git gunk
|
|
31
|
-
.join('\n');
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*
|
|
6
|
+
* @format
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DiffStrategies = void 0;
|
|
10
|
+
exports.DiffStrategies = {
|
|
11
|
+
/**
|
|
12
|
+
* Assume the override is the same as the original
|
|
13
|
+
*/
|
|
14
|
+
assumeSame: () => ({
|
|
15
|
+
diff: async () => '',
|
|
16
|
+
}),
|
|
17
|
+
/**
|
|
18
|
+
* Assume the override is the same as the original
|
|
19
|
+
*/
|
|
20
|
+
compareBaseFile: (overrideFile, baseFile, baseVersion) => ({
|
|
21
|
+
diff: async (gitReactRepo, overrideRepo) => {
|
|
22
|
+
const overrideContents = await overrideRepo.readFile(overrideFile);
|
|
23
|
+
if (!overrideContents) {
|
|
24
|
+
throw new Error(`Couldn't read override "${overrideFile}"`);
|
|
25
|
+
}
|
|
26
|
+
const patch = await gitReactRepo.generatePatch(baseFile, baseVersion, overrideContents);
|
|
27
|
+
return patch
|
|
28
|
+
.trim()
|
|
29
|
+
.split('\n')
|
|
30
|
+
.slice(4) // Ignore Git gunk
|
|
31
|
+
.join('\n');
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
35
|
//# sourceMappingURL=DiffStrategy.js.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
/// <reference types="node" />
|
|
8
|
-
/**
|
|
9
|
-
* A filesystem abstraction that allows listing and reading files
|
|
10
|
-
*/
|
|
11
|
-
export default interface FileRepository {
|
|
12
|
-
/**
|
|
13
|
-
* Return the repository-relative path to files
|
|
14
|
-
* @param globs optional list of globs which files must match
|
|
15
|
-
*/
|
|
16
|
-
listFiles(globs?: string[]): Promise<Array<string>>;
|
|
17
|
-
/**
|
|
18
|
-
* Read the contents of a patch file.
|
|
19
|
-
* @param filename is expected to be relative to the repository root.
|
|
20
|
-
*/
|
|
21
|
-
readFile(filename: string): Promise<Buffer | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Check whether a file exists, and if so whether its a file or directory
|
|
24
|
-
*/
|
|
25
|
-
stat(filename: string): Promise<'file' | 'directory' | 'none'>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Provides access to files
|
|
29
|
-
*/
|
|
30
|
-
export interface WritableFileRepository extends FileRepository {
|
|
31
|
-
/**
|
|
32
|
-
* Sets the contents of a file. Rejects the promise if the file doesn't
|
|
33
|
-
* exist.
|
|
34
|
-
*/
|
|
35
|
-
writeFile(filename: string, content: Buffer | string): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Deletes the file/directory, rejecting the promise if it doesn't exist.
|
|
38
|
-
*/
|
|
39
|
-
deleteFile(filename: string): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Provides access to React Native source files
|
|
43
|
-
*/
|
|
44
|
-
export interface ReactFileRepository extends FileRepository {
|
|
45
|
-
/**
|
|
46
|
-
* Get the React Native version the repo is exploring
|
|
47
|
-
*/
|
|
48
|
-
getVersion(): string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Provides access to React Native source files of arbitrary version
|
|
52
|
-
* {@see ReactFileRepository} for more details
|
|
53
|
-
*/
|
|
54
|
-
export interface VersionedReactFileRepository {
|
|
55
|
-
listFiles(globs: string[] | undefined, version: string): Promise<Array<string>>;
|
|
56
|
-
readFile(filename: string, version: string): Promise<Buffer | null>;
|
|
57
|
-
stat(filename: string, version: string): Promise<'file' | 'directory' | 'none'>;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Convert from a VersionedReactFileRepository to ReactFileRepository
|
|
61
|
-
*/
|
|
62
|
-
export declare function bindVersion(repository: VersionedReactFileRepository, version: string): ReactFileRepository;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
/**
|
|
9
|
+
* A filesystem abstraction that allows listing and reading files
|
|
10
|
+
*/
|
|
11
|
+
export default interface FileRepository {
|
|
12
|
+
/**
|
|
13
|
+
* Return the repository-relative path to files
|
|
14
|
+
* @param globs optional list of globs which files must match
|
|
15
|
+
*/
|
|
16
|
+
listFiles(globs?: string[]): Promise<Array<string>>;
|
|
17
|
+
/**
|
|
18
|
+
* Read the contents of a patch file.
|
|
19
|
+
* @param filename is expected to be relative to the repository root.
|
|
20
|
+
*/
|
|
21
|
+
readFile(filename: string): Promise<Buffer | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Check whether a file exists, and if so whether its a file or directory
|
|
24
|
+
*/
|
|
25
|
+
stat(filename: string): Promise<'file' | 'directory' | 'none'>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Provides access to files
|
|
29
|
+
*/
|
|
30
|
+
export interface WritableFileRepository extends FileRepository {
|
|
31
|
+
/**
|
|
32
|
+
* Sets the contents of a file. Rejects the promise if the file doesn't
|
|
33
|
+
* exist.
|
|
34
|
+
*/
|
|
35
|
+
writeFile(filename: string, content: Buffer | string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Deletes the file/directory, rejecting the promise if it doesn't exist.
|
|
38
|
+
*/
|
|
39
|
+
deleteFile(filename: string): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Provides access to React Native source files
|
|
43
|
+
*/
|
|
44
|
+
export interface ReactFileRepository extends FileRepository {
|
|
45
|
+
/**
|
|
46
|
+
* Get the React Native version the repo is exploring
|
|
47
|
+
*/
|
|
48
|
+
getVersion(): string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Provides access to React Native source files of arbitrary version
|
|
52
|
+
* {@see ReactFileRepository} for more details
|
|
53
|
+
*/
|
|
54
|
+
export interface VersionedReactFileRepository {
|
|
55
|
+
listFiles(globs: string[] | undefined, version: string): Promise<Array<string>>;
|
|
56
|
+
readFile(filename: string, version: string): Promise<Buffer | null>;
|
|
57
|
+
stat(filename: string, version: string): Promise<'file' | 'directory' | 'none'>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Convert from a VersionedReactFileRepository to ReactFileRepository
|
|
61
|
+
*/
|
|
62
|
+
export declare function bindVersion(repository: VersionedReactFileRepository, version: string): ReactFileRepository;
|