arri 0.0.13 → 0.0.15

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.
@@ -0,0 +1,256 @@
1
+ 'use strict';
2
+
3
+ const require$$0 = require('path');
4
+ const cli = require('../cli.cjs');
5
+ const require$$1 = require('os');
6
+ const require$$4 = require('child_process');
7
+ const fs = require('fs');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
10
+
11
+ function _mergeNamespaces(n, m) {
12
+ for (var i = 0; i < m.length; i++) {
13
+ const e = m[i];
14
+ if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
15
+ if (k !== 'default' && !(k in n)) {
16
+ n[k] = e[k];
17
+ }
18
+ } }
19
+ }
20
+ return n;
21
+ }
22
+
23
+ const require$$0__default = /*#__PURE__*/_interopDefaultCompat(require$$0);
24
+ const require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
25
+ const require$$4__default = /*#__PURE__*/_interopDefaultCompat(require$$4);
26
+ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
27
+
28
+ function commonjsRequire(path) {
29
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
30
+ }
31
+
32
+ var watcher = {};
33
+
34
+ var wrapper$1 = {};
35
+
36
+ const path = require$$0__default;
37
+ const micromatch = cli.micromatch_1;
38
+ const isGlob = cli.isGlob;
39
+
40
+ function normalizeOptions(dir, opts = {}) {
41
+ const { ignore, ...rest } = opts;
42
+
43
+ if (Array.isArray(ignore)) {
44
+ opts = { ...rest };
45
+
46
+ for (const value of ignore) {
47
+ if (isGlob(value)) {
48
+ if (!opts.ignoreGlobs) {
49
+ opts.ignoreGlobs = [];
50
+ }
51
+
52
+ const regex = micromatch.makeRe(value, {
53
+ // We set `dot: true` to workaround an issue with the
54
+ // regular expression on Linux where the resulting
55
+ // negative lookahead `(?!(\\/|^)` was never matching
56
+ // in some cases. See also https://bit.ly/3UZlQDm
57
+ dot: true,
58
+ // C++ does not support lookbehind regex patterns, they
59
+ // were only added later to JavaScript engines
60
+ // (https://bit.ly/3V7S6UL)
61
+ lookbehinds: false
62
+ });
63
+ opts.ignoreGlobs.push(regex.source);
64
+ } else {
65
+ if (!opts.ignorePaths) {
66
+ opts.ignorePaths = [];
67
+ }
68
+
69
+ opts.ignorePaths.push(path.resolve(dir, value));
70
+ }
71
+ }
72
+ }
73
+
74
+ return opts;
75
+ }
76
+
77
+ wrapper$1.createWrapper = (binding) => {
78
+ return {
79
+ writeSnapshot(dir, snapshot, opts) {
80
+ return binding.writeSnapshot(
81
+ path.resolve(dir),
82
+ path.resolve(snapshot),
83
+ normalizeOptions(dir, opts),
84
+ );
85
+ },
86
+ getEventsSince(dir, snapshot, opts) {
87
+ return binding.getEventsSince(
88
+ path.resolve(dir),
89
+ path.resolve(snapshot),
90
+ normalizeOptions(dir, opts),
91
+ );
92
+ },
93
+ async subscribe(dir, fn, opts) {
94
+ dir = path.resolve(dir);
95
+ opts = normalizeOptions(dir, opts);
96
+ await binding.subscribe(dir, fn, opts);
97
+
98
+ return {
99
+ unsubscribe() {
100
+ return binding.unsubscribe(dir, fn, opts);
101
+ },
102
+ };
103
+ },
104
+ unsubscribe(dir, fn, opts) {
105
+ return binding.unsubscribe(
106
+ path.resolve(dir),
107
+ fn,
108
+ normalizeOptions(dir, opts),
109
+ );
110
+ }
111
+ };
112
+ };
113
+
114
+ var detectLibc;
115
+ var hasRequiredDetectLibc;
116
+
117
+ function requireDetectLibc () {
118
+ if (hasRequiredDetectLibc) return detectLibc;
119
+ hasRequiredDetectLibc = 1;
120
+
121
+ var platform = require$$1__default.platform();
122
+ var spawnSync = require$$4__default.spawnSync;
123
+ var readdirSync = fs__default.readdirSync;
124
+
125
+ var GLIBC = 'glibc';
126
+ var MUSL = 'musl';
127
+
128
+ var spawnOptions = {
129
+ encoding: 'utf8',
130
+ env: process.env
131
+ };
132
+
133
+ if (!spawnSync) {
134
+ spawnSync = function () {
135
+ return { status: 126, stdout: '', stderr: '' };
136
+ };
137
+ }
138
+
139
+ function contains (needle) {
140
+ return function (haystack) {
141
+ return haystack.indexOf(needle) !== -1;
142
+ };
143
+ }
144
+
145
+ function versionFromMuslLdd (out) {
146
+ return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1];
147
+ }
148
+
149
+ function safeReaddirSync (path) {
150
+ try {
151
+ return readdirSync(path);
152
+ } catch (e) {}
153
+ return [];
154
+ }
155
+
156
+ var family = '';
157
+ var version = '';
158
+ var method = '';
159
+
160
+ if (platform === 'linux') {
161
+ // Try getconf
162
+ var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions);
163
+ if (glibc.status === 0) {
164
+ family = GLIBC;
165
+ version = glibc.stdout.trim().split(' ')[1];
166
+ method = 'getconf';
167
+ } else {
168
+ // Try ldd
169
+ var ldd = spawnSync('ldd', ['--version'], spawnOptions);
170
+ if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) {
171
+ family = MUSL;
172
+ version = versionFromMuslLdd(ldd.stdout);
173
+ method = 'ldd';
174
+ } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) {
175
+ family = MUSL;
176
+ version = versionFromMuslLdd(ldd.stderr);
177
+ method = 'ldd';
178
+ } else {
179
+ // Try filesystem (family only)
180
+ var lib = safeReaddirSync('/lib');
181
+ if (lib.some(contains('-linux-gnu'))) {
182
+ family = GLIBC;
183
+ method = 'filesystem';
184
+ } else if (lib.some(contains('libc.musl-'))) {
185
+ family = MUSL;
186
+ method = 'filesystem';
187
+ } else if (lib.some(contains('ld-musl-'))) {
188
+ family = MUSL;
189
+ method = 'filesystem';
190
+ } else {
191
+ var usrSbin = safeReaddirSync('/usr/sbin');
192
+ if (usrSbin.some(contains('glibc'))) {
193
+ family = GLIBC;
194
+ method = 'filesystem';
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ var isNonGlibcLinux = (family !== '' && family !== GLIBC);
202
+
203
+ detectLibc = {
204
+ GLIBC: GLIBC,
205
+ MUSL: MUSL,
206
+ family: family,
207
+ version: version,
208
+ method: method,
209
+ isNonGlibcLinux: isNonGlibcLinux
210
+ };
211
+ return detectLibc;
212
+ }
213
+
214
+ const {createWrapper} = wrapper$1;
215
+
216
+ let name = `@parcel/watcher-${process.platform}-${process.arch}`;
217
+ if (process.platform === 'linux') {
218
+ const { MUSL, family } = requireDetectLibc();
219
+ if (family === MUSL) {
220
+ name += '-musl';
221
+ } else {
222
+ name += '-glibc';
223
+ }
224
+ }
225
+
226
+ let binding;
227
+ try {
228
+ binding = commonjsRequire(name);
229
+ } catch (err) {
230
+ try {
231
+ binding = require('./build/Release/watcher.node');
232
+ } catch (err) {
233
+ try {
234
+ binding = require('./build/Debug/watcher.node');
235
+ } catch (err) {
236
+ throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
237
+ }
238
+ }
239
+ }
240
+
241
+ const wrapper = createWrapper(binding);
242
+ var writeSnapshot = watcher.writeSnapshot = wrapper.writeSnapshot;
243
+ var getEventsSince = watcher.getEventsSince = wrapper.getEventsSince;
244
+ var subscribe = watcher.subscribe = wrapper.subscribe;
245
+ var unsubscribe = watcher.unsubscribe = wrapper.unsubscribe;
246
+
247
+ const index = /*#__PURE__*/_mergeNamespaces({
248
+ __proto__: null,
249
+ default: watcher,
250
+ getEventsSince: getEventsSince,
251
+ subscribe: subscribe,
252
+ unsubscribe: unsubscribe,
253
+ writeSnapshot: writeSnapshot
254
+ }, [watcher]);
255
+
256
+ exports.index = index;
@@ -0,0 +1,247 @@
1
+ import require$$0 from 'path';
2
+ import { m as micromatch_1, i as isGlob$1 } from '../cli.mjs';
3
+ import require$$1 from 'os';
4
+ import require$$4 from 'child_process';
5
+ import fs from 'fs';
6
+
7
+ function _mergeNamespaces(n, m) {
8
+ for (var i = 0; i < m.length; i++) {
9
+ const e = m[i];
10
+ if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
11
+ if (k !== 'default' && !(k in n)) {
12
+ n[k] = e[k];
13
+ }
14
+ } }
15
+ }
16
+ return n;
17
+ }
18
+
19
+ function commonjsRequire(path) {
20
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
21
+ }
22
+
23
+ var watcher = {};
24
+
25
+ var wrapper$1 = {};
26
+
27
+ const path = require$$0;
28
+ const micromatch = micromatch_1;
29
+ const isGlob = isGlob$1;
30
+
31
+ function normalizeOptions(dir, opts = {}) {
32
+ const { ignore, ...rest } = opts;
33
+
34
+ if (Array.isArray(ignore)) {
35
+ opts = { ...rest };
36
+
37
+ for (const value of ignore) {
38
+ if (isGlob(value)) {
39
+ if (!opts.ignoreGlobs) {
40
+ opts.ignoreGlobs = [];
41
+ }
42
+
43
+ const regex = micromatch.makeRe(value, {
44
+ // We set `dot: true` to workaround an issue with the
45
+ // regular expression on Linux where the resulting
46
+ // negative lookahead `(?!(\\/|^)` was never matching
47
+ // in some cases. See also https://bit.ly/3UZlQDm
48
+ dot: true,
49
+ // C++ does not support lookbehind regex patterns, they
50
+ // were only added later to JavaScript engines
51
+ // (https://bit.ly/3V7S6UL)
52
+ lookbehinds: false
53
+ });
54
+ opts.ignoreGlobs.push(regex.source);
55
+ } else {
56
+ if (!opts.ignorePaths) {
57
+ opts.ignorePaths = [];
58
+ }
59
+
60
+ opts.ignorePaths.push(path.resolve(dir, value));
61
+ }
62
+ }
63
+ }
64
+
65
+ return opts;
66
+ }
67
+
68
+ wrapper$1.createWrapper = (binding) => {
69
+ return {
70
+ writeSnapshot(dir, snapshot, opts) {
71
+ return binding.writeSnapshot(
72
+ path.resolve(dir),
73
+ path.resolve(snapshot),
74
+ normalizeOptions(dir, opts),
75
+ );
76
+ },
77
+ getEventsSince(dir, snapshot, opts) {
78
+ return binding.getEventsSince(
79
+ path.resolve(dir),
80
+ path.resolve(snapshot),
81
+ normalizeOptions(dir, opts),
82
+ );
83
+ },
84
+ async subscribe(dir, fn, opts) {
85
+ dir = path.resolve(dir);
86
+ opts = normalizeOptions(dir, opts);
87
+ await binding.subscribe(dir, fn, opts);
88
+
89
+ return {
90
+ unsubscribe() {
91
+ return binding.unsubscribe(dir, fn, opts);
92
+ },
93
+ };
94
+ },
95
+ unsubscribe(dir, fn, opts) {
96
+ return binding.unsubscribe(
97
+ path.resolve(dir),
98
+ fn,
99
+ normalizeOptions(dir, opts),
100
+ );
101
+ }
102
+ };
103
+ };
104
+
105
+ var detectLibc;
106
+ var hasRequiredDetectLibc;
107
+
108
+ function requireDetectLibc () {
109
+ if (hasRequiredDetectLibc) return detectLibc;
110
+ hasRequiredDetectLibc = 1;
111
+
112
+ var platform = require$$1.platform();
113
+ var spawnSync = require$$4.spawnSync;
114
+ var readdirSync = fs.readdirSync;
115
+
116
+ var GLIBC = 'glibc';
117
+ var MUSL = 'musl';
118
+
119
+ var spawnOptions = {
120
+ encoding: 'utf8',
121
+ env: process.env
122
+ };
123
+
124
+ if (!spawnSync) {
125
+ spawnSync = function () {
126
+ return { status: 126, stdout: '', stderr: '' };
127
+ };
128
+ }
129
+
130
+ function contains (needle) {
131
+ return function (haystack) {
132
+ return haystack.indexOf(needle) !== -1;
133
+ };
134
+ }
135
+
136
+ function versionFromMuslLdd (out) {
137
+ return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1];
138
+ }
139
+
140
+ function safeReaddirSync (path) {
141
+ try {
142
+ return readdirSync(path);
143
+ } catch (e) {}
144
+ return [];
145
+ }
146
+
147
+ var family = '';
148
+ var version = '';
149
+ var method = '';
150
+
151
+ if (platform === 'linux') {
152
+ // Try getconf
153
+ var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions);
154
+ if (glibc.status === 0) {
155
+ family = GLIBC;
156
+ version = glibc.stdout.trim().split(' ')[1];
157
+ method = 'getconf';
158
+ } else {
159
+ // Try ldd
160
+ var ldd = spawnSync('ldd', ['--version'], spawnOptions);
161
+ if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) {
162
+ family = MUSL;
163
+ version = versionFromMuslLdd(ldd.stdout);
164
+ method = 'ldd';
165
+ } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) {
166
+ family = MUSL;
167
+ version = versionFromMuslLdd(ldd.stderr);
168
+ method = 'ldd';
169
+ } else {
170
+ // Try filesystem (family only)
171
+ var lib = safeReaddirSync('/lib');
172
+ if (lib.some(contains('-linux-gnu'))) {
173
+ family = GLIBC;
174
+ method = 'filesystem';
175
+ } else if (lib.some(contains('libc.musl-'))) {
176
+ family = MUSL;
177
+ method = 'filesystem';
178
+ } else if (lib.some(contains('ld-musl-'))) {
179
+ family = MUSL;
180
+ method = 'filesystem';
181
+ } else {
182
+ var usrSbin = safeReaddirSync('/usr/sbin');
183
+ if (usrSbin.some(contains('glibc'))) {
184
+ family = GLIBC;
185
+ method = 'filesystem';
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ var isNonGlibcLinux = (family !== '' && family !== GLIBC);
193
+
194
+ detectLibc = {
195
+ GLIBC: GLIBC,
196
+ MUSL: MUSL,
197
+ family: family,
198
+ version: version,
199
+ method: method,
200
+ isNonGlibcLinux: isNonGlibcLinux
201
+ };
202
+ return detectLibc;
203
+ }
204
+
205
+ const {createWrapper} = wrapper$1;
206
+
207
+ let name = `@parcel/watcher-${process.platform}-${process.arch}`;
208
+ if (process.platform === 'linux') {
209
+ const { MUSL, family } = requireDetectLibc();
210
+ if (family === MUSL) {
211
+ name += '-musl';
212
+ } else {
213
+ name += '-glibc';
214
+ }
215
+ }
216
+
217
+ let binding;
218
+ try {
219
+ binding = commonjsRequire(name);
220
+ } catch (err) {
221
+ try {
222
+ binding = require('./build/Release/watcher.node');
223
+ } catch (err) {
224
+ try {
225
+ binding = require('./build/Debug/watcher.node');
226
+ } catch (err) {
227
+ throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
228
+ }
229
+ }
230
+ }
231
+
232
+ const wrapper = createWrapper(binding);
233
+ var writeSnapshot = watcher.writeSnapshot = wrapper.writeSnapshot;
234
+ var getEventsSince = watcher.getEventsSince = wrapper.getEventsSince;
235
+ var subscribe = watcher.subscribe = wrapper.subscribe;
236
+ var unsubscribe = watcher.unsubscribe = wrapper.unsubscribe;
237
+
238
+ const index = /*#__PURE__*/_mergeNamespaces({
239
+ __proto__: null,
240
+ default: watcher,
241
+ getEventsSince: getEventsSince,
242
+ subscribe: subscribe,
243
+ unsubscribe: unsubscribe,
244
+ writeSnapshot: writeSnapshot
245
+ }, [watcher]);
246
+
247
+ export { index as i };