refactor(Cypress): installed cypress-cucumber-preprocessor and writed a feature file and it's cycode

This commit is contained in:
Simon Priet
2021-09-06 20:39:49 +02:00
parent 30ae95b375
commit a0d70f98f2
214 changed files with 18373 additions and 4889 deletions

103
node_modules/fsevents/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,103 @@
language: objective-c
env:
global:
- secure: "gve1nkeKkwFEG1VAT3i+JwYyAdF0gKXwKx0uxbkBTsmm2M+0MDusohQdFLoEIkSIFktXBIDefoa7iGpLKRfG2VsZLpwJgnvnD0HqbnuR+k+W+bu7BHt4CAaR6GTllsDCjyq9zNyhUThzSnf2WNIpOEF5kHspZlbGfawURuUJH/U="
- secure: "jqVpmWxxBVXu2X8+XJMpKH0cooc2EKz9xKL2znBfYdNafJORSXcFAVbjCX5mZmVDcgIMwDtm2+gIG4P73hzJ2e3S+y2Z9ROJGyXHa3AxUTvXHQsxqzH8coHHqB8vTvfr0t2O5aKfpvpICpSea39r0hzNoMv6Ie5SwBdqj1YY9K0="
matrix:
- NODE_VERSION="v13"
- NODE_VERSION="v12"
- NODE_VERSION="v11"
- NODE_VERSION="v10"
- NODE_VERSION="v9"
- NODE_VERSION="v8"
- NODE_VERSION="v7"
- NODE_VERSION="v6"
before_install:
- echo $TRAVIS_OS_NAME
# commit
# ------------------------
# The commit message is used to determine the whether to manually
# invoke a binary publish
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
# node
# ------------------------
- export PATH=./node_modules/.bin/:$PATH
- rm -rf ~/.nvm && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
- source ~/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- npm install -g npm@3
- node --version
- npm --version
- nvm --version
# publish dependencies
# ------------------------
- npm install node-gyp -g
- npm install aws-sdk
install:
# in the first instance we build from source to create the initial binary
# which can then be used to create a package
- npm install --build-from-source
- npm test
before_script:
# Detemine if a publish is required.
#
# a) we are building a tag
# b) we put [publish binary] in the commit message
- PUBLISH_BINARY=false
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi; # a
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi; # b
# package & publish
# ------------------------
- if [[ $PUBLISH_BINARY == true ]]; then ./node_modules/.bin/node-pre-gyp package publish; fi;
# clean-up
# ------------------------
- ./node_modules/.bin/node-pre-gyp clean
- node-gyp clean
script:
# validate
# ------------------------
# Post publishing a release verify that installing will pull down latest
# binary from remote host
- INSTALL_RESULT=0
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
- ./node_modules/.bin/node-pre-gyp clean
# failure?
# ------------------------
# if install returned non zero (errored) then we first unpublish and then
# call false so travis will bail at this line.
- if [[ $INSTALL_RESULT != 0 ]]; then ./node_modules/.bin/node-pre-gyp unpublish; fi;
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";false; fi;
after_success:
# display all published binaries
- npm run node-pre-gyp info

8
node_modules/fsevents/ISSUE_TEMPLATE.md generated vendored Normal file
View File

@@ -0,0 +1,8 @@
If you are NOT on OS X and have come here to file an issue about compatibility problems,
please stop and go to #115 for your answer.
You can look through many other similar closed issues as well if you're interested:
https://github.com/strongloop/fsevents/search?utf8=%E2%9C%93&q=%22notsup%22+OR+%22EBADPLATFORM%22&type=Issues.
If you are here to report an issue observed while using this module on OS X, please delete
all this pre-filled text then go ahead and submit your report.

22
node_modules/fsevents/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
-----------
Copyright (C) 2010-2014 Philipp Dunkel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

78
node_modules/fsevents/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,78 @@
# fsevents [![NPM](https://nodei.co/npm/fsevents.png)](https://nodei.co/npm/fsevents/)
Native access to OS X FSEvents in [Node.js](http://nodejs.org/)
The FSEvents API in OS X allows applications to register for notifications of
changes to a given directory tree. It is a very fast and lightweight alternative
to kqueue.
This is a low-level library. For a cross-compatible file watching module that
uses fsevents, check out [Chokidar](https://www.npmjs.com/package/chokidar).
* [Module Site & GitHub](https://github.com/strongloop/fsevents)
* [NPM Page](https://npmjs.org/package/fsevents)
## Installation
$ npm install fsevents
## Usage
```js
var fsevents = require('fsevents');
var watcher = fsevents(__dirname);
watcher.on('fsevent', function(path, flags, id) { }); // RAW Event as emitted by OS-X
watcher.on('change', function(path, info) { }); // Common Event for all changes
watcher.start() // To start observation
watcher.stop() // To end observation
```
### Events
* *fsevent* - RAW Event as emitted by OS-X
* *change* - Common Event for all changes
* *created* - A File-System-Item has been created
* *deleted* - A File-System-Item has been deleted
* *modified* - A File-System-Item has been modified
* *moved-out* - A File-System-Item has been moved away from this location
* *moved-in* - A File-System-Item has been moved into this location
All events except *fsevent* take an *info* object as the second parameter of the callback. The structure of this object is:
```js
{
"event": "<event-type>",
"id": <eventi-id>,
"path": "<path-that-this-is-about>",
"type": "<file|directory|symlink>",
"changes": {
"inode": true, // Has the iNode Meta-Information changed
"finder": false, // Has the Finder Meta-Data changed
"access": false, // Have the access permissions changed
"xattrs": false // Have the xAttributes changed
},
"flags": <raw-flags>
}
```
## MIT License
Copyright (C) 2010-2014 Philipp Dunkel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

21
node_modules/fsevents/binding.gyp generated vendored Normal file
View File

@@ -0,0 +1,21 @@
{
"targets": [
{ "target_name": "" }
],
"conditions": [
['OS=="mac"', {
"targets": [{
"target_name": "fse",
"sources": ["fsevents.cc"],
"xcode_settings": {
"OTHER_LDFLAGS": [
"-framework CoreFoundation -framework CoreServices"
]
},
"include_dirs": [
"<!(node -e \"require('nan')\")"
]
}]
}]
]
}

88
node_modules/fsevents/fsevents.cc generated vendored Normal file
View File

@@ -0,0 +1,88 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
#include "nan.h"
#include "uv.h"
#include "v8.h"
#include "CoreFoundation/CoreFoundation.h"
#include "CoreServices/CoreServices.h"
#include <iostream>
#include <vector>
#include "src/storage.cc"
namespace fse {
class FSEvents : public Nan::ObjectWrap {
public:
explicit FSEvents(const char *path);
~FSEvents();
uv_mutex_t mutex;
// async.cc
uv_async_t async;
void asyncStart();
void asyncTrigger();
void asyncStop();
// thread.cc
uv_thread_t thread;
CFRunLoopRef threadloop;
void threadStart();
static void threadRun(void *ctx);
void threadStop();
// methods.cc - internal
Nan::AsyncResource async_resource;
void emitEvent(const char *path, UInt32 flags, UInt64 id);
// Common
CFArrayRef paths;
std::vector<fse_event*> events;
static void Initialize(v8::Local<v8::Object> exports);
// methods.cc - exposed
static NAN_METHOD(New);
static NAN_METHOD(Stop);
static NAN_METHOD(Start);
};
}
using namespace fse;
FSEvents::FSEvents(const char *path)
: async_resource("fsevents:FSEvents") {
CFStringRef dirs[] = { CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8) };
paths = CFArrayCreate(NULL, (const void **)&dirs, 1, NULL);
threadloop = NULL;
if (uv_mutex_init(&mutex)) abort();
}
FSEvents::~FSEvents() {
CFRelease(paths);
uv_mutex_destroy(&mutex);
}
#ifndef kFSEventStreamEventFlagItemCreated
#define kFSEventStreamEventFlagItemCreated 0x00000010
#endif
#include "src/async.cc"
#include "src/thread.cc"
#include "src/constants.cc"
#include "src/methods.cc"
void FSEvents::Initialize(v8::Local<v8::Object> exports) {
v8::Isolate* isolate = exports->GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(FSEvents::New);
tpl->SetClassName(Nan::New<v8::String>("FSEvents").ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeTemplate(tpl, "start", Nan::New<v8::FunctionTemplate>(FSEvents::Start));
Nan::SetPrototypeTemplate(tpl, "stop", Nan::New<v8::FunctionTemplate>(FSEvents::Stop));
Nan::Set(exports, Nan::New<v8::String>("Constants").ToLocalChecked(), Constants());
Nan::Set(exports, Nan::New<v8::String>("FSEvents").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked());
}
NODE_MODULE(fse, FSEvents::Initialize)

106
node_modules/fsevents/fsevents.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
/* jshint node:true */
'use strict';
if (process.platform !== 'darwin')
throw new Error('Module \'fsevents\' is not compatible with platform \'' + process.platform + '\'');
var Native = require("bindings")("fse");
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var inherits = require('util').inherits;
function FSEvents(path, handler) {
EventEmitter.call(this);
Object.defineProperty(this, '_impl', {
value: new Native.FSEvents(String(path || ''), handler),
enumerable: false,
writable: false
});
}
inherits(FSEvents, EventEmitter);
proxies(FSEvents, Native.FSEvents);
module.exports = watch;
module.exports.getInfo = getInfo;
module.exports.FSEvents = Native.FSEvents;
module.exports.Constants = Native.Constants;
var defer = global.setImmediate || process.nextTick;
function watch(path) {
var fse = new FSEvents(String(path || ''), handler);
EventEmitter.call(fse);
return fse;
function handler(path, flags, id) {
defer(function() {
fse.emit('fsevent', path, flags, id);
var info = getInfo(path, flags);
info.id = id;
if (info.event === 'moved') {
fs.stat(info.path, function(err, stat) {
info.event = (err || !stat) ? 'moved-out' : 'moved-in';
fse.emit('change', path, info);
fse.emit(info.event, path, info);
});
} else {
fse.emit('change', path, info);
fse.emit(info.event, path, info);
}
});
}
}
function proxies(ctor, target) {
Object.keys(target.prototype).filter(function(key) {
return typeof target.prototype[key] === 'function';
}).forEach(function(key) {
ctor.prototype[key] = function() {
this._impl[key].apply(this._impl, arguments);
return this;
}
});
}
function getFileType(flags) {
if (Native.Constants.kFSEventStreamEventFlagItemIsFile & flags) return 'file';
if (Native.Constants.kFSEventStreamEventFlagItemIsDir & flags) return 'directory';
if (Native.Constants.kFSEventStreamEventFlagItemIsSymlink & flags) return 'symlink';
}
function getEventType(flags) {
if (Native.Constants.kFSEventStreamEventFlagItemRemoved & flags) return 'deleted';
if (Native.Constants.kFSEventStreamEventFlagItemRenamed & flags) return 'moved';
if (Native.Constants.kFSEventStreamEventFlagItemCreated & flags) return 'created';
if (Native.Constants.kFSEventStreamEventFlagItemModified & flags) return 'modified';
if (Native.Constants.kFSEventStreamEventFlagRootChanged & flags) return 'root-changed';
return 'unknown';
}
function getFileChanges(flags) {
return {
inode: !! (Native.Constants.kFSEventStreamEventFlagItemInodeMetaMod & flags),
finder: !! (Native.Constants.kFSEventStreamEventFlagItemFinderInfoMod & flags),
access: !! (Native.Constants.kFSEventStreamEventFlagItemChangeOwner & flags),
xattrs: !! (Native.Constants.kFSEventStreamEventFlagItemXattrMod & flags)
};
}
function getInfo(path, flags) {
return {
path: path,
event: getEventType(flags),
type: getFileType(flags),
changes: getFileChanges(flags),
flags: flags
};
}

13
node_modules/fsevents/install.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
const { spawn } = require('child_process');
const rebuildIfDarwin = () => {
if (process.platform !== 'darwin') {
console.log();
console.log(`Skipping 'fsevents' build as platform ${process.platform} is not supported`);
process.exit(0);
} else {
spawn('node-gyp', ['rebuild'], { stdio: 'inherit' });
}
};
rebuildIfDarwin();

34
node_modules/fsevents/package.json generated vendored Normal file
View File

@@ -0,0 +1,34 @@
{
"name": "fsevents",
"version": "1.2.13",
"description": "Native Access to Mac OS-X FSEvents",
"main": "fsevents.js",
"dependencies": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
},
"os": [
"darwin"
],
"engines": {
"node": ">= 4.0"
},
"scripts": {
"test": "node ./test/fsevents.js && node ./test/function.js 2> /dev/null",
"install": "node install.js"
},
"repository": {
"type": "git",
"url": "https://github.com/strongloop/fsevents.git"
},
"keywords": [
"fsevents",
"mac"
],
"author": "Philipp Dunkel <pip@pipobscure.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/strongloop/fsevents/issues"
},
"homepage": "https://github.com/strongloop/fsevents"
}

43
node_modules/fsevents/src/async.cc generated vendored Normal file
View File

@@ -0,0 +1,43 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
void async_propagate(uv_async_t *async) {
if (!async->data) return;
FSEvents *fse = (FSEvents *)async->data;
CFIndex idx, cnt;
fse_event *event;
char pathbuf[1024];
const char *pathptr = NULL;
uv_mutex_lock(&fse->mutex);
cnt = fse->events.size();
for (idx=0; idx<cnt; idx++) {
event = fse->events.at(idx);
if (event == NULL) continue;
pathptr = CFStringGetCStringPtr(event->path, kCFStringEncodingUTF8);
if (!pathptr) CFStringGetCString(event->path, pathbuf, 1024, kCFStringEncodingUTF8);
fse->emitEvent(pathptr ? pathptr : pathbuf, event->flags, event->id);
delete event;
}
if (cnt>0) fse->events.clear();
uv_mutex_unlock(&fse->mutex);
}
void FSEvents::asyncStart() {
if (async.data == this) return;
async.data = this;
uv_async_init(uv_default_loop(), &async, (uv_async_cb) async_propagate);
}
void FSEvents::asyncTrigger() {
if (async.data != this) return;
uv_async_send(&async);
}
void FSEvents::asyncStop() {
if (async.data != this) return;
async.data = NULL;
uv_close((uv_handle_t *) &async, NULL);
}

110
node_modules/fsevents/src/constants.cc generated vendored Normal file
View File

@@ -0,0 +1,110 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
// constants from https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/index.html#//apple_ref/doc/constant_group/FSEventStreamEventFlags
#ifndef kFSEventStreamEventFlagNone
#define kFSEventStreamEventFlagNone 0x00000000
#endif
#ifndef kFSEventStreamEventFlagMustScanSubDirs
#define kFSEventStreamEventFlagMustScanSubDirs 0x00000001
#endif
#ifndef kFSEventStreamEventFlagUserDropped
#define kFSEventStreamEventFlagUserDropped 0x00000002
#endif
#ifndef kFSEventStreamEventFlagKernelDropped
#define kFSEventStreamEventFlagKernelDropped 0x00000004
#endif
#ifndef kFSEventStreamEventFlagEventIdsWrapped
#define kFSEventStreamEventFlagEventIdsWrapped 0x00000008
#endif
#ifndef kFSEventStreamEventFlagHistoryDone
#define kFSEventStreamEventFlagHistoryDone 0x00000010
#endif
#ifndef kFSEventStreamEventFlagRootChanged
#define kFSEventStreamEventFlagRootChanged 0x00000020
#endif
#ifndef kFSEventStreamEventFlagMount
#define kFSEventStreamEventFlagMount 0x00000040
#endif
#ifndef kFSEventStreamEventFlagUnmount
#define kFSEventStreamEventFlagUnmount 0x00000080
#endif
#ifndef kFSEventStreamEventFlagItemCreated
#define kFSEventStreamEventFlagItemCreated 0x00000100
#endif
#ifndef kFSEventStreamEventFlagItemRemoved
#define kFSEventStreamEventFlagItemRemoved 0x00000200
#endif
#ifndef kFSEventStreamEventFlagItemInodeMetaMod
#define kFSEventStreamEventFlagItemInodeMetaMod 0x00000400
#endif
#ifndef kFSEventStreamEventFlagItemRenamed
#define kFSEventStreamEventFlagItemRenamed 0x00000800
#endif
#ifndef kFSEventStreamEventFlagItemModified
#define kFSEventStreamEventFlagItemModified 0x00001000
#endif
#ifndef kFSEventStreamEventFlagItemFinderInfoMod
#define kFSEventStreamEventFlagItemFinderInfoMod 0x00002000
#endif
#ifndef kFSEventStreamEventFlagItemChangeOwner
#define kFSEventStreamEventFlagItemChangeOwner 0x00004000
#endif
#ifndef kFSEventStreamEventFlagItemXattrMod
#define kFSEventStreamEventFlagItemXattrMod 0x00008000
#endif
#ifndef kFSEventStreamEventFlagItemIsFile
#define kFSEventStreamEventFlagItemIsFile 0x00010000
#endif
#ifndef kFSEventStreamEventFlagItemIsDir
#define kFSEventStreamEventFlagItemIsDir 0x00020000
#endif
#ifndef kFSEventStreamEventFlagItemIsSymlink
#define kFSEventStreamEventFlagItemIsSymlink 0x00040000
#endif
static v8::Local<v8::Object> Constants() {
v8::Local<v8::Object> object = Nan::New<v8::Object>();
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagNone").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagNone));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagMustScanSubDirs").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagMustScanSubDirs));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagUserDropped").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagUserDropped));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagKernelDropped").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagKernelDropped));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagEventIdsWrapped").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagEventIdsWrapped));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagHistoryDone").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagHistoryDone));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagRootChanged").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagRootChanged));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagMount").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagMount));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagUnmount").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagUnmount));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemCreated").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemCreated));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemRemoved").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemRemoved));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemInodeMetaMod").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemInodeMetaMod));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemRenamed").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemRenamed));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemModified").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemModified));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemFinderInfoMod").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemFinderInfoMod));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemChangeOwner").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemChangeOwner));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemXattrMod").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemXattrMod));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemIsFile").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemIsFile));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemIsDir").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemIsDir));
Nan::Set(object, Nan::New<v8::String>("kFSEventStreamEventFlagItemIsSymlink").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemIsSymlink));
return object;
}

44
node_modules/fsevents/src/methods.cc generated vendored Normal file
View File

@@ -0,0 +1,44 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
void FSEvents::emitEvent(const char *path, UInt32 flags, UInt64 id) {
Nan::HandleScope handle_scope;
v8::Local<v8::Object> object = handle();
v8::Local<v8::Value> key = Nan::New<v8::String>("handler").ToLocalChecked();
Nan::Callback handler(Nan::To<v8::Function>(Nan::Get(object, key).ToLocalChecked()).ToLocalChecked());
v8::Local<v8::Value> argv[] = {
Nan::New<v8::String>(path).ToLocalChecked(),
Nan::New<v8::Number>(flags),
Nan::New<v8::Number>(id)
};
handler.Call(3, argv, &async_resource);
}
NAN_METHOD(FSEvents::New) {
Nan::Utf8String path(info[0]);
FSEvents *fse = new FSEvents(*path);
fse->Wrap(info.This());
Nan::Set(info.This(), Nan::New<v8::String>("handler").ToLocalChecked(), info[1]);
info.GetReturnValue().Set(info.This());
}
NAN_METHOD(FSEvents::Stop) {
FSEvents* fse = Nan::ObjectWrap::Unwrap<FSEvents>(info.This());
fse->threadStop();
fse->asyncStop();
info.GetReturnValue().Set(info.This());
}
NAN_METHOD(FSEvents::Start) {
FSEvents* fse = Nan::ObjectWrap::Unwrap<FSEvents>(info.This());
fse->asyncStart();
fse->threadStart();
info.GetReturnValue().Set(info.This());
}

27
node_modules/fsevents/src/storage.cc generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
struct fse_event {
UInt64 id;
UInt32 flags;
CFStringRef path;
fse_event(CFStringRef eventPath, UInt32 eventFlag, UInt64 eventId) {
this->path = eventPath;
this->flags = eventFlag;
this->id = eventId;
if (this->path != NULL)
CFRetain(this->path);
}
~fse_event() {
if (this->path != NULL)
CFRelease(this->path);
}
private:
fse_event(const fse_event&);
void operator=(const fse_event&);
};

71
node_modules/fsevents/src/thread.cc generated vendored Normal file
View File

@@ -0,0 +1,71 @@
/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/
// constants from https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/index.html#//apple_ref/doc/constant_group/FSEventStreamCreateFlags
#ifndef kFSEventStreamCreateFlagNone
#define kFSEventStreamCreateFlagNone 0x00000000
#endif
#ifndef kFSEventStreamCreateFlagUseCFTypes
#define kFSEventStreamCreateFlagUseCFTypes 0x00000001
#endif
#ifndef kFSEventStreamCreateFlagNoDefer
#define kFSEventStreamCreateFlagNoDefer 0x00000002
#endif
#ifndef kFSEventStreamCreateFlagWatchRoot
#define kFSEventStreamCreateFlagWatchRoot 0x00000004
#endif
#ifndef kFSEventStreamCreateFlagIgnoreSelf
#define kFSEventStreamCreateFlagIgnoreSelf 0x00000008
#endif
#ifndef kFSEventStreamCreateFlagFileEvents
#define kFSEventStreamCreateFlagFileEvents 0x00000010
#endif
void FSEvents::threadStart() {
if (threadloop) return;
if (uv_thread_create(&thread, &FSEvents::threadRun, this)) abort();
}
void HandleStreamEvents(ConstFSEventStreamRef stream, void *ctx, size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]) {
FSEvents * fse = (FSEvents *)ctx;
size_t idx;
uv_mutex_lock(&fse->mutex);
for (idx=0; idx < numEvents; idx++) {
fse_event *event = new fse_event(
(CFStringRef)CFArrayGetValueAtIndex((CFArrayRef)eventPaths, idx),
eventFlags[idx],
eventIds[idx]
);
fse->events.push_back(event);
}
fse->asyncTrigger();
uv_mutex_unlock(&fse->mutex);
}
void FSEvents::threadRun(void *ctx) {
FSEvents *fse = (FSEvents*)ctx;
FSEventStreamContext context = { 0, ctx, NULL, NULL, NULL };
fse->threadloop = CFRunLoopGetCurrent();
FSEventStreamRef stream = FSEventStreamCreate(NULL, &HandleStreamEvents, &context, fse->paths, kFSEventStreamEventIdSinceNow, (CFAbsoluteTime) 0.1, kFSEventStreamCreateFlagNone | kFSEventStreamCreateFlagWatchRoot | kFSEventStreamCreateFlagFileEvents | kFSEventStreamCreateFlagUseCFTypes);
FSEventStreamScheduleWithRunLoop(stream, fse->threadloop, kCFRunLoopDefaultMode);
FSEventStreamStart(stream);
CFRunLoopRun();
FSEventStreamStop(stream);
FSEventStreamUnscheduleFromRunLoop(stream, fse->threadloop, kCFRunLoopDefaultMode);
FSEventStreamInvalidate(stream);
FSEventStreamRelease(stream);
fse->threadloop = NULL;
}
void FSEvents::threadStop() {
if (!threadloop) return;
CFRunLoopStop(threadloop);
if (uv_thread_join(&thread)) abort();
}