source: imaps-frontend/node_modules/@parcel/watcher/index.js@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 1.2 KB
Line 
1const {createWrapper} = require('./wrapper');
2
3let name = `@parcel/watcher-${process.platform}-${process.arch}`;
4if (process.platform === 'linux') {
5 const { MUSL, family } = require('detect-libc');
6 if (family === MUSL) {
7 name += '-musl';
8 } else {
9 name += '-glibc';
10 }
11}
12
13let binding;
14try {
15 binding = require(name);
16} catch (err) {
17 handleError(err);
18 try {
19 binding = require('./build/Release/watcher.node');
20 } catch (err) {
21 handleError(err);
22 try {
23 binding = require('./build/Debug/watcher.node');
24 } catch (err) {
25 handleError(err);
26 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.`);
27 }
28 }
29}
30
31function handleError(err) {
32 if (err?.code !== 'MODULE_NOT_FOUND') {
33 throw err;
34 }
35}
36
37const wrapper = createWrapper(binding);
38exports.writeSnapshot = wrapper.writeSnapshot;
39exports.getEventsSince = wrapper.getEventsSince;
40exports.subscribe = wrapper.subscribe;
41exports.unsubscribe = wrapper.unsubscribe;
Note: See TracBrowser for help on using the repository browser.