mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
# add dist
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,3 @@
|
||||
*.log
|
||||
node_modules
|
||||
workspace.xml
|
||||
.idea/
|
||||
dist/
|
@@ -1,8 +1,7 @@
|
||||
npm-debug.log
|
||||
node_modules
|
||||
jspm_packages
|
||||
.idea
|
||||
lib
|
||||
build
|
||||
!make.js
|
||||
node_modules/
|
||||
/node_modules
|
4
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.d.ts
vendored
Normal file
4
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare class HelloWorld {
|
||||
message: string;
|
||||
onClick(): void;
|
||||
}
|
44
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.js
vendored
Normal file
44
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
System.register(['angular2/core'], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var core_1;
|
||||
var HelloWorld;
|
||||
return {
|
||||
setters:[
|
||||
function (core_1_1) {
|
||||
core_1 = core_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
HelloWorld = (function () {
|
||||
function HelloWorld() {
|
||||
this.message = "Click Me ...";
|
||||
}
|
||||
HelloWorld.prototype.onClick = function () {
|
||||
this.message = "Hello World!";
|
||||
console.log(this.message);
|
||||
};
|
||||
HelloWorld = __decorate([
|
||||
core_1.Component({
|
||||
selector: 'hello-world',
|
||||
styles: ["\n h1 {\n color: blue;\n }\n "],
|
||||
template: "<div>\n <h1 (click)=\"onClick()\">{{message}}</h1>\n </div>"
|
||||
}),
|
||||
__metadata('design:paramtypes', [])
|
||||
], HelloWorld);
|
||||
return HelloWorld;
|
||||
}());
|
||||
exports_1("HelloWorld", HelloWorld);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=HelloWorld.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["HelloWorld.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;YAaA;gBAAA;oBAEI,YAAO,GAAG,cAAc,CAAC;gBAQ7B,CAAC;gBANG,4BAAO,GAAP;oBACI,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;oBAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAE9B,CAAC;gBAnBL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,aAAa;wBACvB,MAAM,EAAE,CAAC,0DAIR,CAAC;wBACF,QAAQ,EAAE,4FAEQ;qBACrB,CAAC;;8BAAA;gBAWF,iBAAC;YAAD,CAVA,AAUC,IAAA;YAVD,mCAUC,CAAA","file":"HelloWorld.js","sourcesContent":["import {Component} from 'angular2/core';\n\n@Component({\n selector: 'hello-world',\n styles: [`\n h1 {\n color: blue;\n }\n `],\n template: `<div>\n <h1 (click)=\"onClick()\">{{message}}</h1>\n </div>`\n})\nexport class HelloWorld {\n\n message = \"Click Me ...\";\n\n onClick() {\n this.message = \"Hello World!\";\n console.log(this.message);\n\n }\n\n}\n"],"sourceRoot":"/source/"}
|
24
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.ts
vendored
Normal file
24
ng2-components/ng2-alfresco-documentslist/dist/HelloWorld.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Component} from 'angular2/core';
|
||||
|
||||
@Component({
|
||||
selector: 'hello-world',
|
||||
styles: [`
|
||||
h1 {
|
||||
color: blue;
|
||||
}
|
||||
`],
|
||||
template: `<div>
|
||||
<h1 (click)="onClick()">{{message}}</h1>
|
||||
</div>`
|
||||
})
|
||||
export class HelloWorld {
|
||||
|
||||
message = "Click Me ...";
|
||||
|
||||
onClick() {
|
||||
this.message = "Hello World!";
|
||||
console.log(this.message);
|
||||
|
||||
}
|
||||
|
||||
}
|
16
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.d.ts
vendored
Normal file
16
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Http } from 'angular2/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { FolderEntity } from "./core/entities/folder.entity";
|
||||
import { DocumentEntity } from "./core/entities/document.entity";
|
||||
export declare class AlfrescoService {
|
||||
private http;
|
||||
constructor(http: Http);
|
||||
private _host;
|
||||
private _baseUrlPath;
|
||||
host: string;
|
||||
private getBaseUrl();
|
||||
getFolder(folder: string): Observable<FolderEntity>;
|
||||
getDocumentThumbnailUrl(document: DocumentEntity): string;
|
||||
getContentUrl(document: DocumentEntity): string;
|
||||
private handleError(error);
|
||||
}
|
81
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.js
vendored
Normal file
81
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.js
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
System.register(['angular2/core', 'angular2/http', 'rxjs/Observable'], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var core_1, http_1, Observable_1;
|
||||
var AlfrescoService;
|
||||
return {
|
||||
setters:[
|
||||
function (core_1_1) {
|
||||
core_1 = core_1_1;
|
||||
},
|
||||
function (http_1_1) {
|
||||
http_1 = http_1_1;
|
||||
},
|
||||
function (Observable_1_1) {
|
||||
Observable_1 = Observable_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
AlfrescoService = (function () {
|
||||
function AlfrescoService(http) {
|
||||
this.http = http;
|
||||
this._host = 'http://127.0.0.1:8080';
|
||||
this._baseUrlPath = '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
||||
}
|
||||
Object.defineProperty(AlfrescoService.prototype, "host", {
|
||||
get: function () {
|
||||
return this._host;
|
||||
},
|
||||
set: function (value) {
|
||||
this._host = value;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
AlfrescoService.prototype.getBaseUrl = function () {
|
||||
return this.host + this._baseUrlPath;
|
||||
};
|
||||
AlfrescoService.prototype.getFolder = function (folder) {
|
||||
var headers = new http_1.Headers({
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Basic ' + btoa('admin:admin')
|
||||
});
|
||||
var options = new http_1.RequestOptions({ headers: headers });
|
||||
return this.http
|
||||
.get(this.getBaseUrl() + folder, options)
|
||||
.map(function (res) { return res.json(); })
|
||||
.do(function (data) { return console.log(data); }) // eyeball results in the console
|
||||
.catch(this.handleError);
|
||||
};
|
||||
AlfrescoService.prototype.getDocumentThumbnailUrl = function (document) {
|
||||
return this._host + '/alfresco/service/api/node/' + document.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&ph=true&lastModified=1';
|
||||
};
|
||||
AlfrescoService.prototype.getContentUrl = function (document) {
|
||||
return this._host + '/alfresco/service/' + document.contentUrl;
|
||||
};
|
||||
AlfrescoService.prototype.handleError = function (error) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.error(error);
|
||||
return Observable_1.Observable.throw(error.json().error || 'Server error');
|
||||
};
|
||||
AlfrescoService = __decorate([
|
||||
core_1.Injectable(),
|
||||
__metadata('design:paramtypes', [http_1.Http])
|
||||
], AlfrescoService);
|
||||
return AlfrescoService;
|
||||
}());
|
||||
exports_1("AlfrescoService", AlfrescoService);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=alfresco.service.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["alfresco.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;YAOA;gBACI,yBAAoB,IAAU;oBAAV,SAAI,GAAJ,IAAI,CAAM;oBAEtB,UAAK,GAAW,uBAAuB,CAAC;oBACxC,iBAAY,GAAW,sDAAsD,CAAC;gBAHrD,CAAC;gBAKlC,sBAAW,iCAAI;yBAAf;wBACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACtB,CAAC;yBAED,UAAgB,KAAY;wBACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACvB,CAAC;;;mBAJA;gBAMO,oCAAU,GAAlB;oBACI,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;gBACzC,CAAC;gBAED,mCAAS,GAAT,UAAU,MAAc;oBACpB,IAAI,OAAO,GAAG,IAAI,cAAO,CAAC;wBACtB,cAAc,EAAE,kBAAkB;wBAClC,eAAe,EAAE,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC;qBAClD,CAAC,CAAC;oBACH,IAAI,OAAO,GAAG,IAAI,qBAAc,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;oBACvD,MAAM,CAAC,IAAI,CAAC,IAAI;yBACX,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,OAAO,CAAC;yBACxC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAe,GAAG,CAAC,IAAI,EAAE,EAAzB,CAAyB,CAAC;yBACrC,EAAE,CAAC,UAAA,IAAI,IAAI,OAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAjB,CAAiB,CAAC,CAAC,iCAAiC;yBAC/D,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBACjC,CAAC;gBAED,iDAAuB,GAAvB,UAAwB,QAAwB;oBAC5C,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,6BAA6B,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,mEAAmE,CAAC;gBACnK,CAAC;gBAED,uCAAa,GAAb,UAAc,QAAwB;oBAClC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC;gBACnE,CAAC;gBAEO,qCAAW,GAAnB,UAAqB,KAAe;oBAChC,mFAAmF;oBACnF,4CAA4C;oBAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACrB,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,cAAc,CAAC,CAAC;gBAClE,CAAC;gBA7CL;oBAAC,iBAAU,EAAE;;mCAAA;gBA8Cb,sBAAC;YAAD,CA7CA,AA6CC,IAAA;YA7CD,6CA6CC,CAAA","file":"alfresco.service.js","sourcesContent":["import {Injectable} from 'angular2/core';\nimport {Http, Response, RequestOptions, Headers} from 'angular2/http';\nimport {Observable} from 'rxjs/Observable';\nimport {FolderEntity} from \"./core/entities/folder.entity\";\nimport {DocumentEntity} from \"./core/entities/document.entity\";\n\n@Injectable()\nexport class AlfrescoService {\n constructor(private http: Http) {}\n\n private _host: string = 'http://127.0.0.1:8080';\n private _baseUrlPath: string = '/alfresco/service/slingshot/doclib/doclist/all/site/';\n\n public get host():string {\n return this._host;\n }\n\n public set host(value:string) {\n this._host = value;\n }\n\n private getBaseUrl():string {\n return this.host + this._baseUrlPath;\n }\n\n getFolder(folder: string) {\n let headers = new Headers({\n 'Content-Type': 'application/json',\n 'Authorization': 'Basic ' + btoa('admin:admin')\n });\n let options = new RequestOptions({ headers: headers });\n return this.http\n .get(this.getBaseUrl() + folder, options)\n .map(res => <FolderEntity> res.json())\n .do(data => console.log(data)) // eyeball results in the console\n .catch(this.handleError);\n }\n\n getDocumentThumbnailUrl(document: DocumentEntity) {\n return this._host + '/alfresco/service/api/node/' + document.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&ph=true&lastModified=1';\n }\n\n getContentUrl(document: DocumentEntity) {\n return this._host + '/alfresco/service/' + document.contentUrl;\n }\n\n private handleError (error: Response) {\n // in a real world app, we may send the error to some remote logging infrastructure\n // instead of just logging it to the console\n console.error(error);\n return Observable.throw(error.json().error || 'Server error');\n }\n}\n"],"sourceRoot":"/source/"}
|
53
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.ts
vendored
Normal file
53
ng2-components/ng2-alfresco-documentslist/dist/alfresco.service.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import {Injectable} from 'angular2/core';
|
||||
import {Http, Response, RequestOptions, Headers} from 'angular2/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {FolderEntity} from "./core/entities/folder.entity";
|
||||
import {DocumentEntity} from "./core/entities/document.entity";
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoService {
|
||||
constructor(private http: Http) {}
|
||||
|
||||
private _host: string = 'http://127.0.0.1:8080';
|
||||
private _baseUrlPath: string = '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
||||
|
||||
public get host():string {
|
||||
return this._host;
|
||||
}
|
||||
|
||||
public set host(value:string) {
|
||||
this._host = value;
|
||||
}
|
||||
|
||||
private getBaseUrl():string {
|
||||
return this.host + this._baseUrlPath;
|
||||
}
|
||||
|
||||
getFolder(folder: string) {
|
||||
let headers = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Basic ' + btoa('admin:admin')
|
||||
});
|
||||
let options = new RequestOptions({ headers: headers });
|
||||
return this.http
|
||||
.get(this.getBaseUrl() + folder, options)
|
||||
.map(res => <FolderEntity> res.json())
|
||||
.do(data => console.log(data)) // eyeball results in the console
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getDocumentThumbnailUrl(document: DocumentEntity) {
|
||||
return this._host + '/alfresco/service/api/node/' + document.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&ph=true&lastModified=1';
|
||||
}
|
||||
|
||||
getContentUrl(document: DocumentEntity) {
|
||||
return this._host + '/alfresco/service/' + document.contentUrl;
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.error(error);
|
||||
return Observable.throw(error.json().error || 'Server error');
|
||||
}
|
||||
}
|
13
ng2-components/ng2-alfresco-documentslist/dist/components.d.ts
vendored
Normal file
13
ng2-components/ng2-alfresco-documentslist/dist/components.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { HelloWorld } from './HelloWorld';
|
||||
import { DocumentList } from "./document-list.component.ts";
|
||||
import { AlfrescoService } from "./alfresco.service.ts";
|
||||
export * from './HelloWorld';
|
||||
export * from './document-list.component.ts';
|
||||
export * from './alfresco.service.ts';
|
||||
declare var _default: {
|
||||
directives: (typeof HelloWorld | typeof DocumentList)[];
|
||||
providers: typeof AlfrescoService[];
|
||||
};
|
||||
export default _default;
|
||||
export declare const ALFRESCO_DIRECTIVES: [any];
|
||||
export declare const ALFRESCO_PROVIDERS: [any];
|
42
ng2-components/ng2-alfresco-documentslist/dist/components.js
vendored
Normal file
42
ng2-components/ng2-alfresco-documentslist/dist/components.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
System.register(['./HelloWorld', "./document-list.component.ts", "./alfresco.service.ts"], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var HelloWorld_1, document_list_component_ts_1, alfresco_service_ts_1;
|
||||
var ALFRESCO_DIRECTIVES, ALFRESCO_PROVIDERS;
|
||||
var exportedNames_1 = {
|
||||
'ALFRESCO_DIRECTIVES': true,
|
||||
'ALFRESCO_PROVIDERS': true
|
||||
};
|
||||
function exportStar_1(m) {
|
||||
var exports = {};
|
||||
for(var n in m) {
|
||||
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n];
|
||||
}
|
||||
exports_1(exports);
|
||||
}
|
||||
return {
|
||||
setters:[
|
||||
function (HelloWorld_1_1) {
|
||||
HelloWorld_1 = HelloWorld_1_1;
|
||||
exportStar_1(HelloWorld_1_1);
|
||||
},
|
||||
function (document_list_component_ts_1_1) {
|
||||
document_list_component_ts_1 = document_list_component_ts_1_1;
|
||||
exportStar_1(document_list_component_ts_1_1);
|
||||
},
|
||||
function (alfresco_service_ts_1_1) {
|
||||
alfresco_service_ts_1 = alfresco_service_ts_1_1;
|
||||
exportStar_1(alfresco_service_ts_1_1);
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("default",{
|
||||
directives: [HelloWorld_1.HelloWorld, document_list_component_ts_1.DocumentList],
|
||||
providers: [alfresco_service_ts_1.AlfrescoService]
|
||||
});
|
||||
exports_1("ALFRESCO_DIRECTIVES", ALFRESCO_DIRECTIVES = [HelloWorld_1.HelloWorld, document_list_component_ts_1.DocumentList]);
|
||||
exports_1("ALFRESCO_PROVIDERS", ALFRESCO_PROVIDERS = [alfresco_service_ts_1.AlfrescoService]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=components.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/components.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/components.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["components.ts"],"names":[],"mappings":";;;;QAaa,mBAAmB,EACnB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;YAN/B,oBAAe;gBACX,UAAU,EAAE,CAAC,uBAAU,EAAE,yCAAY,CAAC;gBACtC,SAAS,EAAE,CAAC,qCAAe,CAAC;aAC/B,EAAA;YAEY,iCAAA,mBAAmB,GAAU,CAAC,uBAAU,EAAE,yCAAY,CAAC,CAAA,CAAC;YACxD,gCAAA,kBAAkB,GAAU,CAAC,qCAAe,CAAC,CAAA,CAAC","file":"components.js","sourcesContent":["import { HelloWorld } from './HelloWorld';\nimport { DocumentList } from \"./document-list.component.ts\";\nimport { AlfrescoService } from \"./alfresco.service.ts\";\n\nexport * from './HelloWorld';\nexport * from './document-list.component.ts';\nexport * from './alfresco.service.ts';\n\nexport default {\n directives: [HelloWorld, DocumentList],\n providers: [AlfrescoService]\n}\n\nexport const ALFRESCO_DIRECTIVES: [any] = [HelloWorld, DocumentList];\nexport const ALFRESCO_PROVIDERS: [any] = [AlfrescoService];\n"],"sourceRoot":"/source/"}
|
15
ng2-components/ng2-alfresco-documentslist/dist/components.ts
vendored
Normal file
15
ng2-components/ng2-alfresco-documentslist/dist/components.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { HelloWorld } from './HelloWorld';
|
||||
import { DocumentList } from "./document-list.component.ts";
|
||||
import { AlfrescoService } from "./alfresco.service.ts";
|
||||
|
||||
export * from './HelloWorld';
|
||||
export * from './document-list.component.ts';
|
||||
export * from './alfresco.service.ts';
|
||||
|
||||
export default {
|
||||
directives: [HelloWorld, DocumentList],
|
||||
providers: [AlfrescoService]
|
||||
}
|
||||
|
||||
export const ALFRESCO_DIRECTIVES: [any] = [HelloWorld, DocumentList];
|
||||
export const ALFRESCO_PROVIDERS: [any] = [AlfrescoService];
|
31
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.d.ts
vendored
Normal file
31
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { LocationEntity } from "./location.entity";
|
||||
export declare class DocumentEntity {
|
||||
nodeRef: string;
|
||||
nodeType: string;
|
||||
type: string;
|
||||
mimetype: string;
|
||||
isFolder: boolean;
|
||||
isLink: boolean;
|
||||
fileName: string;
|
||||
displayName: string;
|
||||
status: string;
|
||||
title: string;
|
||||
description: string;
|
||||
author: string;
|
||||
createdOn: string;
|
||||
createdBy: string;
|
||||
createdByUser: string;
|
||||
modifiedOn: string;
|
||||
modifiedBy: string;
|
||||
modifiedByUser: string;
|
||||
lockedBy: string;
|
||||
lockedByUser: string;
|
||||
size: number;
|
||||
version: string;
|
||||
contentUrl: string;
|
||||
webdavUrl: string;
|
||||
actionSet: string;
|
||||
tags: string[];
|
||||
activeWorkflows: string;
|
||||
location: LocationEntity;
|
||||
}
|
18
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.js
vendored
Normal file
18
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
System.register([], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var DocumentEntity;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
DocumentEntity = (function () {
|
||||
function DocumentEntity() {
|
||||
}
|
||||
return DocumentEntity;
|
||||
}());
|
||||
exports_1("DocumentEntity", DocumentEntity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=document.entity.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["core/entities/document.entity.ts"],"names":[],"mappings":";;;;;;;YAGA;gBAAA;gBA6BA,CAAC;gBAAD,qBAAC;YAAD,CA7BA,AA6BC,IAAA;YA7BD,2CA6BC,CAAA","file":"core/entities/document.entity.js","sourcesContent":["// contains only limited subset of available fields\nimport {LocationEntity} from \"./location.entity\";\n\nexport class DocumentEntity {\n nodeRef: string;\n nodeType: string;\n type: string;\n mimetype: string;\n isFolder: boolean;\n isLink: boolean;\n fileName: string;\n displayName: string;\n status: string;\n title: string;\n description: string;\n author: string;\n createdOn: string;\n createdBy: string;\n createdByUser: string;\n modifiedOn: string;\n modifiedBy: string;\n modifiedByUser: string;\n lockedBy: string;\n lockedByUser: string;\n size: number;\n version: string;\n contentUrl: string;\n webdavUrl: string;\n actionSet: string;\n tags: string[];\n activeWorkflows: string;\n location: LocationEntity;\n}\n"],"sourceRoot":"/source/"}
|
33
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.ts
vendored
Normal file
33
ng2-components/ng2-alfresco-documentslist/dist/core/entities/document.entity.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// contains only limited subset of available fields
|
||||
import {LocationEntity} from "./location.entity";
|
||||
|
||||
export class DocumentEntity {
|
||||
nodeRef: string;
|
||||
nodeType: string;
|
||||
type: string;
|
||||
mimetype: string;
|
||||
isFolder: boolean;
|
||||
isLink: boolean;
|
||||
fileName: string;
|
||||
displayName: string;
|
||||
status: string;
|
||||
title: string;
|
||||
description: string;
|
||||
author: string;
|
||||
createdOn: string;
|
||||
createdBy: string;
|
||||
createdByUser: string;
|
||||
modifiedOn: string;
|
||||
modifiedBy: string;
|
||||
modifiedByUser: string;
|
||||
lockedBy: string;
|
||||
lockedByUser: string;
|
||||
size: number;
|
||||
version: string;
|
||||
contentUrl: string;
|
||||
webdavUrl: string;
|
||||
actionSet: string;
|
||||
tags: string[];
|
||||
activeWorkflows: string;
|
||||
location: LocationEntity;
|
||||
}
|
4
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.d.ts
vendored
Normal file
4
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { DocumentEntity } from "./document.entity";
|
||||
export declare class FolderEntity {
|
||||
items: DocumentEntity[];
|
||||
}
|
19
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.js
vendored
Normal file
19
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
System.register([], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var FolderEntity;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
// contains only limited subset of available fields
|
||||
FolderEntity = (function () {
|
||||
function FolderEntity() {
|
||||
}
|
||||
return FolderEntity;
|
||||
}());
|
||||
exports_1("FolderEntity", FolderEntity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=folder.entity.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["core/entities/folder.entity.ts"],"names":[],"mappings":";;;;;;;YAEA,mDAAmD;YACnD;gBAAA;gBAEA,CAAC;gBAAD,mBAAC;YAAD,CAFA,AAEC,IAAA;YAFD,uCAEC,CAAA","file":"core/entities/folder.entity.js","sourcesContent":["import {DocumentEntity} from \"./document.entity\";\n\n// contains only limited subset of available fields\nexport class FolderEntity {\n items: DocumentEntity[];\n}\n"],"sourceRoot":"/source/"}
|
6
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.ts
vendored
Normal file
6
ng2-components/ng2-alfresco-documentslist/dist/core/entities/folder.entity.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import {DocumentEntity} from "./document.entity";
|
||||
|
||||
// contains only limited subset of available fields
|
||||
export class FolderEntity {
|
||||
items: DocumentEntity[];
|
||||
}
|
12
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.d.ts
vendored
Normal file
12
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export declare class LocationEntity {
|
||||
repositoryId: string;
|
||||
site: string;
|
||||
siteTitle: string;
|
||||
container: string;
|
||||
path: string;
|
||||
file: string;
|
||||
parent: LocationParentEntity;
|
||||
}
|
||||
export declare class LocationParentEntity {
|
||||
nodeRef: string;
|
||||
}
|
25
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.js
vendored
Normal file
25
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
System.register([], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var LocationEntity, LocationParentEntity;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
// contains only limited subset of available fields
|
||||
LocationEntity = (function () {
|
||||
function LocationEntity() {
|
||||
}
|
||||
return LocationEntity;
|
||||
}());
|
||||
exports_1("LocationEntity", LocationEntity);
|
||||
LocationParentEntity = (function () {
|
||||
function LocationParentEntity() {
|
||||
}
|
||||
return LocationParentEntity;
|
||||
}());
|
||||
exports_1("LocationParentEntity", LocationParentEntity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=location.entity.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["core/entities/location.entity.ts"],"names":[],"mappings":";;;;;;;YAAA,mDAAmD;YACnD;gBAAA;gBAQA,CAAC;gBAAD,qBAAC;YAAD,CARA,AAQC,IAAA;YARD,2CAQC,CAAA;YAED;gBAAA;gBAEA,CAAC;gBAAD,2BAAC;YAAD,CAFA,AAEC,IAAA;YAFD,uDAEC,CAAA","file":"core/entities/location.entity.js","sourcesContent":["// contains only limited subset of available fields\nexport class LocationEntity {\n repositoryId: string;\n site: string;\n siteTitle: string;\n container: string;\n path: string;\n file: string;\n parent: LocationParentEntity;\n}\n\nexport class LocationParentEntity {\n nodeRef: string;\n}\n"],"sourceRoot":"/source/"}
|
14
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.ts
vendored
Normal file
14
ng2-components/ng2-alfresco-documentslist/dist/core/entities/location.entity.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// contains only limited subset of available fields
|
||||
export class LocationEntity {
|
||||
repositoryId: string;
|
||||
site: string;
|
||||
siteTitle: string;
|
||||
container: string;
|
||||
path: string;
|
||||
file: string;
|
||||
parent: LocationParentEntity;
|
||||
}
|
||||
|
||||
export class LocationParentEntity {
|
||||
nodeRef: string;
|
||||
}
|
32
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.d.ts
vendored
Normal file
32
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { OnInit, EventEmitter } from "angular2/core";
|
||||
import { AlfrescoService } from "./alfresco.service";
|
||||
import { FolderEntity } from "./core/entities/folder.entity";
|
||||
import { DocumentEntity } from "./core/entities/document.entity";
|
||||
export declare class DocumentList implements OnInit {
|
||||
private _alfrescoService;
|
||||
navigate: boolean;
|
||||
breadcrumb: boolean;
|
||||
folderIconClass: string;
|
||||
thumbnails: boolean;
|
||||
downloads: boolean;
|
||||
itemClick: EventEmitter<any>;
|
||||
rootFolder: {
|
||||
name: string;
|
||||
path: string;
|
||||
};
|
||||
currentFolderPath: string;
|
||||
folder: FolderEntity;
|
||||
errorMessage: any;
|
||||
route: any[];
|
||||
canNavigateParent(): boolean;
|
||||
constructor(_alfrescoService: AlfrescoService);
|
||||
ngOnInit(): void;
|
||||
private displayFolderContent(path);
|
||||
onNavigateParentClick($event: any): void;
|
||||
onDownloadClick(event: any): void;
|
||||
onItemClick(item: DocumentEntity, $event: any): void;
|
||||
goToRoute(r: any, $event: any): void;
|
||||
private getItemPath(item);
|
||||
getContentUrl(document: DocumentEntity): string;
|
||||
getDocumentThumbnailUrl(document: DocumentEntity): string;
|
||||
}
|
160
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.js
vendored
Normal file
160
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.js
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
System.register(["angular2/core", "./alfresco.service"], function(exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var core_1, alfresco_service_1;
|
||||
var DocumentList;
|
||||
return {
|
||||
setters:[
|
||||
function (core_1_1) {
|
||||
core_1 = core_1_1;
|
||||
},
|
||||
function (alfresco_service_1_1) {
|
||||
alfresco_service_1 = alfresco_service_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
DocumentList = (function () {
|
||||
function DocumentList(_alfrescoService) {
|
||||
this._alfrescoService = _alfrescoService;
|
||||
// example: <alfresco-document-list [navigate]="false"></alfresco-document-list>
|
||||
this.navigate = true;
|
||||
// example: <alfresco-document-list [breadcrumb]="true"></alfresco-document-list>
|
||||
this.breadcrumb = false;
|
||||
// example: <alfresco-document-list folder-icon-class="fa fa-folder fa-4x"></alfresco-document-list>
|
||||
this.folderIconClass = 'fa fa-folder-o fa-4x';
|
||||
// example: <alfresco-document-list #list [thumbnails]="false"></alfresco-document-list>
|
||||
this.thumbnails = true;
|
||||
// example: <alfresco-document-list #list [downloads]="false"></alfresco-document-list>
|
||||
this.downloads = true;
|
||||
this.itemClick = new core_1.EventEmitter();
|
||||
this.rootFolder = {
|
||||
name: 'Document Library',
|
||||
path: 'swsdp/documentLibrary'
|
||||
};
|
||||
this.currentFolderPath = 'swsdp/documentLibrary';
|
||||
this.route = [];
|
||||
}
|
||||
DocumentList.prototype.canNavigateParent = function () {
|
||||
return this.navigate &&
|
||||
!this.breadcrumb &&
|
||||
this.currentFolderPath !== this.rootFolder.path;
|
||||
};
|
||||
DocumentList.prototype.ngOnInit = function () {
|
||||
this.route.push(this.rootFolder);
|
||||
this.displayFolderContent(this.rootFolder.path);
|
||||
};
|
||||
DocumentList.prototype.displayFolderContent = function (path) {
|
||||
var _this = this;
|
||||
this.currentFolderPath = path;
|
||||
this._alfrescoService
|
||||
.getFolder(path)
|
||||
.subscribe(function (folder) { return _this.folder = folder; }, function (error) { return _this.errorMessage = error; });
|
||||
};
|
||||
DocumentList.prototype.onNavigateParentClick = function ($event) {
|
||||
if ($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
if (this.navigate) {
|
||||
this.route.pop();
|
||||
var parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder;
|
||||
if (parent) {
|
||||
this.displayFolderContent(parent.path);
|
||||
}
|
||||
}
|
||||
};
|
||||
DocumentList.prototype.onDownloadClick = function (event) {
|
||||
event.stopPropagation();
|
||||
};
|
||||
DocumentList.prototype.onItemClick = function (item, $event) {
|
||||
if ($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
this.itemClick.emit({
|
||||
value: item
|
||||
});
|
||||
if (this.navigate && item) {
|
||||
if (item.isFolder) {
|
||||
var path = this.getItemPath(item);
|
||||
this.route.push({
|
||||
name: item.displayName,
|
||||
path: path
|
||||
});
|
||||
this.displayFolderContent(path);
|
||||
}
|
||||
}
|
||||
};
|
||||
DocumentList.prototype.goToRoute = function (r, $event) {
|
||||
if ($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
if (this.navigate) {
|
||||
var idx = this.route.indexOf(r);
|
||||
if (idx > -1) {
|
||||
this.route.splice(idx + 1);
|
||||
this.displayFolderContent(r.path);
|
||||
}
|
||||
}
|
||||
};
|
||||
DocumentList.prototype.getItemPath = function (item) {
|
||||
var container = item.location.container;
|
||||
var path = item.location.path !== '/' ? (item.location.path + '/') : '/';
|
||||
var relativePath = container + path + item.fileName;
|
||||
return item.location.site + '/' + relativePath;
|
||||
};
|
||||
DocumentList.prototype.getContentUrl = function (document) {
|
||||
return this._alfrescoService.getContentUrl(document);
|
||||
};
|
||||
DocumentList.prototype.getDocumentThumbnailUrl = function (document) {
|
||||
return this._alfrescoService.getDocumentThumbnailUrl(document);
|
||||
};
|
||||
__decorate([
|
||||
core_1.Input(),
|
||||
__metadata('design:type', Boolean)
|
||||
], DocumentList.prototype, "navigate", void 0);
|
||||
__decorate([
|
||||
core_1.Input(),
|
||||
__metadata('design:type', Boolean)
|
||||
], DocumentList.prototype, "breadcrumb", void 0);
|
||||
__decorate([
|
||||
core_1.Input('folder-icon-class'),
|
||||
__metadata('design:type', String)
|
||||
], DocumentList.prototype, "folderIconClass", void 0);
|
||||
__decorate([
|
||||
core_1.Input(),
|
||||
__metadata('design:type', Boolean)
|
||||
], DocumentList.prototype, "thumbnails", void 0);
|
||||
__decorate([
|
||||
core_1.Input(),
|
||||
__metadata('design:type', Boolean)
|
||||
], DocumentList.prototype, "downloads", void 0);
|
||||
__decorate([
|
||||
core_1.Output(),
|
||||
__metadata('design:type', core_1.EventEmitter)
|
||||
], DocumentList.prototype, "itemClick", void 0);
|
||||
DocumentList = __decorate([
|
||||
core_1.Component({
|
||||
selector: 'alfresco-document-list',
|
||||
styles: [
|
||||
"\n :host .breadcrumb {\n margin-bottom: 4px;\n }\n\n :host .folder-icon {\n float: left;\n margin-right: 10px;\n }\n\n :host .file-icon {\n width: 52px;\n height: 52px;\n float: left;\n margin-right: 10px;\n }\n\n :host .document-header:hover {\n text-decoration: underline;\n }\n\n :host .download-button {\n color: #777;\n text-decoration: none;\n }\n\n :host .download-button:hover {\n color: #555;\n }\n "
|
||||
],
|
||||
template: "\n <ol *ngIf=\"breadcrumb\" class=\"breadcrumb\">\n <li *ngFor=\"#r of route; #last = last\" [class.active]=\"last\" [ngSwitch]=\"last\">\n <span *ngSwitchWhen=\"true\">{{r.name}}</span>\n <a *ngSwitchDefault href=\"#\" (click)=\"goToRoute(r, $event)\">{{r.name}}</a>\n </li>\n </ol>\n <div *ngIf=\"folder\" class=\"list-group\">\n <a href=\"#\" *ngIf=\"canNavigateParent()\" (click)=\"onNavigateParentClick($event)\" class=\"list-group-item\">\n <i class=\"fa fa-level-up\"></i> ...\n </a>\n <a href=\"#\" *ngFor=\"#document of folder.items\" (click)=\"onItemClick(document, $event)\" class=\"list-group-item clearfix\">\n <a *ngIf=\"downloads && !document.isFolder\" href=\"{{getContentUrl(document)}}\" (click)=\"onDownloadClick($event)\" class=\"download-button pull-right\" download target=\"_blank\">\n <i class=\"fa fa-download fa-2x\"></i>\n </a>\n <i *ngIf=\"thumbnails && document.isFolder\" class=\"folder-icon {{folderIconClass}}\"></i>\n <img *ngIf=\"thumbnails && !document.isFolder\" class=\"file-icon\" src=\"{{getDocumentThumbnailUrl(document)}}\">\n <h4 class=\"list-group-item-heading document-header\">\n {{document.displayName}}\n </h4>\n <p class=\"list-group-item-text\">{{document.description}}</p>\n <small>\n Modified {{document.modifiedOn}} by {{document.modifiedBy}}\n </small>\n </a>\n </div>\n " /*,
|
||||
providers: [AlfrescoService]*/
|
||||
}),
|
||||
__metadata('design:paramtypes', [alfresco_service_1.AlfrescoService])
|
||||
], DocumentList);
|
||||
return DocumentList;
|
||||
}());
|
||||
exports_1("DocumentList", DocumentList);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=document-list.component.js.map
|
1
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.js.map
vendored
Normal file
1
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
186
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.ts
vendored
Normal file
186
ng2-components/ng2-alfresco-documentslist/dist/document-list.component.ts
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
import {Component, OnInit, Input, Output, EventEmitter} from "angular2/core";
|
||||
import {AlfrescoService} from "./alfresco.service";
|
||||
import {FolderEntity} from "./core/entities/folder.entity";
|
||||
import {DocumentEntity} from "./core/entities/document.entity";
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-document-list',
|
||||
styles: [
|
||||
`
|
||||
:host .breadcrumb {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
:host .folder-icon {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
:host .file-icon {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
:host .document-header:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
:host .download-button {
|
||||
color: #777;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
:host .download-button:hover {
|
||||
color: #555;
|
||||
}
|
||||
`
|
||||
],
|
||||
template: `
|
||||
<ol *ngIf="breadcrumb" class="breadcrumb">
|
||||
<li *ngFor="#r of route; #last = last" [class.active]="last" [ngSwitch]="last">
|
||||
<span *ngSwitchWhen="true">{{r.name}}</span>
|
||||
<a *ngSwitchDefault href="#" (click)="goToRoute(r, $event)">{{r.name}}</a>
|
||||
</li>
|
||||
</ol>
|
||||
<div *ngIf="folder" class="list-group">
|
||||
<a href="#" *ngIf="canNavigateParent()" (click)="onNavigateParentClick($event)" class="list-group-item">
|
||||
<i class="fa fa-level-up"></i> ...
|
||||
</a>
|
||||
<a href="#" *ngFor="#document of folder.items" (click)="onItemClick(document, $event)" class="list-group-item clearfix">
|
||||
<a *ngIf="downloads && !document.isFolder" href="{{getContentUrl(document)}}" (click)="onDownloadClick($event)" class="download-button pull-right" download target="_blank">
|
||||
<i class="fa fa-download fa-2x"></i>
|
||||
</a>
|
||||
<i *ngIf="thumbnails && document.isFolder" class="folder-icon {{folderIconClass}}"></i>
|
||||
<img *ngIf="thumbnails && !document.isFolder" class="file-icon" src="{{getDocumentThumbnailUrl(document)}}">
|
||||
<h4 class="list-group-item-heading document-header">
|
||||
{{document.displayName}}
|
||||
</h4>
|
||||
<p class="list-group-item-text">{{document.description}}</p>
|
||||
<small>
|
||||
Modified {{document.modifiedOn}} by {{document.modifiedBy}}
|
||||
</small>
|
||||
</a>
|
||||
</div>
|
||||
`/*,
|
||||
providers: [AlfrescoService]*/
|
||||
})
|
||||
export class DocumentList implements OnInit {
|
||||
|
||||
// example: <alfresco-document-list [navigate]="false"></alfresco-document-list>
|
||||
@Input() navigate: boolean = true;
|
||||
// example: <alfresco-document-list [breadcrumb]="true"></alfresco-document-list>
|
||||
@Input() breadcrumb: boolean = false;
|
||||
// example: <alfresco-document-list folder-icon-class="fa fa-folder fa-4x"></alfresco-document-list>
|
||||
@Input('folder-icon-class') folderIconClass: string = 'fa fa-folder-o fa-4x';
|
||||
// example: <alfresco-document-list #list [thumbnails]="false"></alfresco-document-list>
|
||||
@Input() thumbnails: boolean = true;
|
||||
// example: <alfresco-document-list #list [downloads]="false"></alfresco-document-list>
|
||||
@Input() downloads: boolean = true;
|
||||
|
||||
@Output() itemClick: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
rootFolder = {
|
||||
name: 'Document Library',
|
||||
path: 'swsdp/documentLibrary'
|
||||
};
|
||||
currentFolderPath: string = 'swsdp/documentLibrary';
|
||||
folder: FolderEntity;
|
||||
errorMessage;
|
||||
|
||||
route: any[] = [];
|
||||
|
||||
canNavigateParent(): boolean {
|
||||
return this.navigate &&
|
||||
!this.breadcrumb &&
|
||||
this.currentFolderPath !== this.rootFolder.path;
|
||||
}
|
||||
|
||||
constructor (
|
||||
private _alfrescoService: AlfrescoService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.push(this.rootFolder);
|
||||
this.displayFolderContent(this.rootFolder.path);
|
||||
}
|
||||
|
||||
private displayFolderContent(path) {
|
||||
this.currentFolderPath = path;
|
||||
this._alfrescoService
|
||||
.getFolder(path)
|
||||
.subscribe(
|
||||
folder => this.folder = folder,
|
||||
error => this.errorMessage = <any>error
|
||||
);
|
||||
}
|
||||
|
||||
onNavigateParentClick($event) {
|
||||
if ($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
|
||||
if (this.navigate) {
|
||||
this.route.pop();
|
||||
var parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder;
|
||||
if (parent) {
|
||||
this.displayFolderContent(parent.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDownloadClick(event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
onItemClick(item: DocumentEntity, $event) {
|
||||
if ($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
|
||||
this.itemClick.emit({
|
||||
value: item
|
||||
});
|
||||
|
||||
if (this.navigate && item) {
|
||||
if (item.isFolder) {
|
||||
var path = this.getItemPath(item);
|
||||
this.route.push({
|
||||
name: item.displayName,
|
||||
path: path
|
||||
});
|
||||
this.displayFolderContent(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
goToRoute(r, $event) {
|
||||
if ($event) {
|
||||
$event.preventDefault();
|
||||
}
|
||||
|
||||
if (this.navigate) {
|
||||
var idx = this.route.indexOf(r);
|
||||
if (idx > -1) {
|
||||
this.route.splice(idx + 1);
|
||||
this.displayFolderContent(r.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private getItemPath(item: DocumentEntity):string {
|
||||
var container = item.location.container;
|
||||
var path = item.location.path !== '/' ? (item.location.path + '/' ) : '/';
|
||||
var relativePath = container + path + item.fileName;
|
||||
return item.location.site + '/' + relativePath;
|
||||
}
|
||||
|
||||
getContentUrl(document: DocumentEntity) {
|
||||
return this._alfrescoService.getContentUrl(document);
|
||||
}
|
||||
|
||||
getDocumentThumbnailUrl(document: DocumentEntity) {
|
||||
return this._alfrescoService.getDocumentThumbnailUrl(document);
|
||||
}
|
||||
}
|
3
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/CONTRIBUTING.md
generated
vendored
Normal file
3
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
To get started, <a
|
||||
href="http://www.clahub.com/agreements/isaacs/abbrev-js">sign the
|
||||
Contributor License Agreement</a>.
|
15
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/LICENSE
generated
vendored
Normal file
15
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/README.md
generated
vendored
Normal file
23
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/README.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# abbrev-js
|
||||
|
||||
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
|
||||
|
||||
Usage:
|
||||
|
||||
var abbrev = require("abbrev");
|
||||
abbrev("foo", "fool", "folding", "flop");
|
||||
|
||||
// returns:
|
||||
{ fl: 'flop'
|
||||
, flo: 'flop'
|
||||
, flop: 'flop'
|
||||
, fol: 'folding'
|
||||
, fold: 'folding'
|
||||
, foldi: 'folding'
|
||||
, foldin: 'folding'
|
||||
, folding: 'folding'
|
||||
, foo: 'foo'
|
||||
, fool: 'fool'
|
||||
}
|
||||
|
||||
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
|
62
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/abbrev.js
generated
vendored
Normal file
62
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/abbrev.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
module.exports = exports = abbrev.abbrev = abbrev
|
||||
|
||||
abbrev.monkeyPatch = monkeyPatch
|
||||
|
||||
function monkeyPatch () {
|
||||
Object.defineProperty(Array.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(this) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Object.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(Object.keys(this)) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
}
|
||||
|
||||
function abbrev (list) {
|
||||
if (arguments.length !== 1 || !Array.isArray(list)) {
|
||||
list = Array.prototype.slice.call(arguments, 0)
|
||||
}
|
||||
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
|
||||
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
|
||||
}
|
||||
|
||||
// sort them lexicographically, so that they're next to their nearest kin
|
||||
args = args.sort(lexSort)
|
||||
|
||||
// walk through each, seeing how much it has in common with the next and previous
|
||||
var abbrevs = {}
|
||||
, prev = ""
|
||||
for (var i = 0, l = args.length ; i < l ; i ++) {
|
||||
var current = args[i]
|
||||
, next = args[i + 1] || ""
|
||||
, nextMatches = true
|
||||
, prevMatches = true
|
||||
if (current === next) continue
|
||||
for (var j = 0, cl = current.length ; j < cl ; j ++) {
|
||||
var curChar = current.charAt(j)
|
||||
nextMatches = nextMatches && curChar === next.charAt(j)
|
||||
prevMatches = prevMatches && curChar === prev.charAt(j)
|
||||
if (!nextMatches && !prevMatches) {
|
||||
j ++
|
||||
break
|
||||
}
|
||||
}
|
||||
prev = current
|
||||
if (j === cl) {
|
||||
abbrevs[current] = current
|
||||
continue
|
||||
}
|
||||
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
|
||||
abbrevs[a] = current
|
||||
a += current.charAt(j)
|
||||
}
|
||||
}
|
||||
return abbrevs
|
||||
}
|
||||
|
||||
function lexSort (a, b) {
|
||||
return a === b ? 0 : a > b ? 1 : -1
|
||||
}
|
75
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/package.json
generated
vendored
Normal file
75
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"abbrev@1",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/browser-sync/node_modules/nopt"
|
||||
]
|
||||
],
|
||||
"_from": "abbrev@>=1.0.0 <2.0.0",
|
||||
"_id": "abbrev@1.0.7",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/abbrev",
|
||||
"_nodeVersion": "2.0.1",
|
||||
"_npmUser": {
|
||||
"email": "isaacs@npmjs.com",
|
||||
"name": "isaacs"
|
||||
},
|
||||
"_npmVersion": "2.10.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "abbrev",
|
||||
"raw": "abbrev@1",
|
||||
"rawSpec": "1",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-sync/nopt",
|
||||
"/typings/nopt"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz",
|
||||
"_shasum": "5b6035b2ee9d4fb5cf859f08a9be81b208491843",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "abbrev@1",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/browser-sync/node_modules/nopt",
|
||||
"author": {
|
||||
"email": "i@izs.me",
|
||||
"name": "Isaac Z. Schlueter"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/abbrev-js/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Like ruby's abbrev module, but in js",
|
||||
"devDependencies": {
|
||||
"tap": "^1.2.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "5b6035b2ee9d4fb5cf859f08a9be81b208491843",
|
||||
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz"
|
||||
},
|
||||
"gitHead": "821d09ce7da33627f91bbd8ed631497ed6f760c2",
|
||||
"homepage": "https://github.com/isaacs/abbrev-js#readme",
|
||||
"license": "ISC",
|
||||
"main": "abbrev.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "i@izs.me",
|
||||
"name": "isaacs"
|
||||
}
|
||||
],
|
||||
"name": "abbrev",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js --cov"
|
||||
},
|
||||
"version": "1.0.7"
|
||||
}
|
47
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/test.js
generated
vendored
Normal file
47
ng2-components/ng2-alfresco-documentslist/dist/node_modules/abbrev/test.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
var abbrev = require('./abbrev.js')
|
||||
var assert = require("assert")
|
||||
var util = require("util")
|
||||
|
||||
console.log("TAP version 13")
|
||||
var count = 0
|
||||
|
||||
function test (list, expect) {
|
||||
count++
|
||||
var actual = abbrev(list)
|
||||
assert.deepEqual(actual, expect,
|
||||
"abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+
|
||||
"actual: "+util.inspect(actual))
|
||||
actual = abbrev.apply(exports, list)
|
||||
assert.deepEqual(abbrev.apply(exports, list), expect,
|
||||
"abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+
|
||||
"actual: "+util.inspect(actual))
|
||||
console.log('ok - ' + list.join(' '))
|
||||
}
|
||||
|
||||
test([ "ruby", "ruby", "rules", "rules", "rules" ],
|
||||
{ rub: 'ruby'
|
||||
, ruby: 'ruby'
|
||||
, rul: 'rules'
|
||||
, rule: 'rules'
|
||||
, rules: 'rules'
|
||||
})
|
||||
test(["fool", "foom", "pool", "pope"],
|
||||
{ fool: 'fool'
|
||||
, foom: 'foom'
|
||||
, poo: 'pool'
|
||||
, pool: 'pool'
|
||||
, pop: 'pope'
|
||||
, pope: 'pope'
|
||||
})
|
||||
test(["a", "ab", "abc", "abcd", "abcde", "acde"],
|
||||
{ a: 'a'
|
||||
, ab: 'ab'
|
||||
, abc: 'abc'
|
||||
, abcd: 'abcd'
|
||||
, abcde: 'abcde'
|
||||
, ac: 'acde'
|
||||
, acd: 'acde'
|
||||
, acde: 'acde'
|
||||
})
|
||||
|
||||
console.log("1..%d", count)
|
170
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/HISTORY.md
generated
vendored
Normal file
170
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
1.2.13 / 2015-09-06
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.6
|
||||
- deps: mime-db@~1.18.0
|
||||
|
||||
1.2.12 / 2015-07-30
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.4
|
||||
- deps: mime-db@~1.16.0
|
||||
|
||||
1.2.11 / 2015-07-16
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.3
|
||||
- deps: mime-db@~1.15.0
|
||||
|
||||
1.2.10 / 2015-07-01
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.2
|
||||
- deps: mime-db@~1.14.0
|
||||
|
||||
1.2.9 / 2015-06-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.1
|
||||
- perf: fix deopt during mapping
|
||||
|
||||
1.2.8 / 2015-06-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.0
|
||||
- deps: mime-db@~1.13.0
|
||||
* perf: avoid argument reassignment & argument slice
|
||||
* perf: avoid negotiator recursive construction
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary bitwise operator
|
||||
|
||||
1.2.7 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.3
|
||||
- Fix media type parameter matching to be case-insensitive
|
||||
|
||||
1.2.6 / 2015-05-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.11
|
||||
- deps: mime-db@~1.9.1
|
||||
* deps: negotiator@0.5.2
|
||||
- Fix comparing media types with quoted values
|
||||
- Fix splitting media types with quoted commas
|
||||
|
||||
1.2.5 / 2015-03-13
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.10
|
||||
- deps: mime-db@~1.8.0
|
||||
|
||||
1.2.4 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* deps: mime-types@~2.0.9
|
||||
- deps: mime-db@~1.7.0
|
||||
* deps: negotiator@0.5.1
|
||||
- Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
1.2.3 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.8
|
||||
- deps: mime-db@~1.6.0
|
||||
|
||||
1.2.2 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.7
|
||||
- deps: mime-db@~1.5.0
|
||||
|
||||
1.2.1 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.5
|
||||
- deps: mime-db@~1.3.1
|
||||
|
||||
1.2.0 / 2014-12-19
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.0
|
||||
- Fix list return order when large accepted list
|
||||
- Fix missing identity encoding when q=0 exists
|
||||
- Remove dynamic building of Negotiator class
|
||||
|
||||
1.1.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.4
|
||||
- deps: mime-db@~1.3.0
|
||||
|
||||
1.1.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.3
|
||||
- deps: mime-db@~1.2.0
|
||||
|
||||
1.1.2 / 2014-10-14
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.9
|
||||
- Fix error when media type has invalid parameter
|
||||
|
||||
1.1.1 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.2
|
||||
- deps: mime-db@~1.1.0
|
||||
* deps: negotiator@0.4.8
|
||||
- Fix all negotiations to be case-insensitive
|
||||
- Stable sort preferences of same quality according to client order
|
||||
|
||||
1.1.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* update `mime-types`
|
||||
|
||||
1.0.7 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix wrong type returned from `type` when match after unknown extension
|
||||
|
||||
1.0.6 / 2014-06-24
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.7
|
||||
|
||||
1.0.5 / 2014-06-20
|
||||
==================
|
||||
|
||||
* fix crash when unknown extension given
|
||||
|
||||
1.0.4 / 2014-06-19
|
||||
==================
|
||||
|
||||
* use `mime-types`
|
||||
|
||||
1.0.3 / 2014-06-11
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.6
|
||||
- Order by specificity when quality is the same
|
||||
|
||||
1.0.2 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix interpretation when header not in request
|
||||
* deps: pin negotiator@0.4.5
|
||||
|
||||
1.0.1 / 2014-01-18
|
||||
==================
|
||||
|
||||
* Identity encoding isn't always acceptable
|
||||
* deps: negotiator@~0.4.0
|
||||
|
||||
1.0.0 / 2013-12-27
|
||||
==================
|
||||
|
||||
* Genesis
|
23
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/LICENSE
generated
vendored
Normal file
23
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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.
|
135
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/README.md
generated
vendored
Normal file
135
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/README.md
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
# accepts
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||
|
||||
In addition to negotiator, it allows:
|
||||
|
||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` as well as `('text/html', 'application/json')`.
|
||||
- Allows type shorthands such as `json`.
|
||||
- Returns `false` when no types match
|
||||
- Treats non-existent headers as `*`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install accepts
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
```
|
||||
|
||||
### accepts(req)
|
||||
|
||||
Create a new `Accepts` object for the given `req`.
|
||||
|
||||
#### .charset(charsets)
|
||||
|
||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .charsets()
|
||||
|
||||
Return the charsets that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .encoding(encodings)
|
||||
|
||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .encodings()
|
||||
|
||||
Return the encodings that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .language(languages)
|
||||
|
||||
Return the first accepted language. If nothing in `languages` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .languages()
|
||||
|
||||
Return the languages that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .type(types)
|
||||
|
||||
Return the first accepted type (and it is returned as the same text as what
|
||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||
is returned.
|
||||
|
||||
The `types` array can contain full MIME types or file extensions. Any value
|
||||
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||
|
||||
#### .types()
|
||||
|
||||
Return the types that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple type negotiation
|
||||
|
||||
This simple example shows how to use `accepts` to return a different typed
|
||||
respond body based on what the client wants to accept. The server lists it's
|
||||
preferences in order and will get back the best match between the client and
|
||||
server.
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
var http = require('http')
|
||||
|
||||
function app(req, res) {
|
||||
var accept = accepts(req)
|
||||
|
||||
// the order of this list is significant; should be server preferred order
|
||||
switch(accept.type(['json', 'html'])) {
|
||||
case 'json':
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.write('{"hello":"world!"}')
|
||||
break
|
||||
case 'html':
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<b>hello, world!</b>')
|
||||
break
|
||||
default:
|
||||
// the fallback is text/plain, so no need to specify it above
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('hello, world!')
|
||||
break
|
||||
}
|
||||
|
||||
res.end()
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000)
|
||||
```
|
||||
|
||||
You can test this out with the cURL program:
|
||||
```sh
|
||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/accepts.svg
|
||||
[npm-url]: https://npmjs.org/package/accepts
|
||||
[node-version-image]: https://img.shields.io/node/v/accepts.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/accepts
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts
|
||||
[downloads-image]: https://img.shields.io/npm/dm/accepts.svg
|
||||
[downloads-url]: https://npmjs.org/package/accepts
|
231
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/index.js
generated
vendored
Normal file
231
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/index.js
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
/*!
|
||||
* accepts
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var Negotiator = require('negotiator')
|
||||
var mime = require('mime-types')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = Accepts
|
||||
|
||||
/**
|
||||
* Create a new Accepts object for the given req.
|
||||
*
|
||||
* @param {object} req
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Accepts(req) {
|
||||
if (!(this instanceof Accepts))
|
||||
return new Accepts(req)
|
||||
|
||||
this.headers = req.headers
|
||||
this.negotiator = new Negotiator(req)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
* the best match when true, otherwise `undefined`, in which
|
||||
* case you should respond with 406 "Not Acceptable".
|
||||
*
|
||||
* The `type` value may be a single mime type string
|
||||
* such as "application/json", the extension name
|
||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||
* or array is given the _best_ match, if any is returned.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // Accept: text/html
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
* this.types('text/html');
|
||||
* // => "text/html"
|
||||
* this.types('json', 'text');
|
||||
* // => "json"
|
||||
* this.types('application/json');
|
||||
* // => "application/json"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('image/png');
|
||||
* this.types('png');
|
||||
* // => undefined
|
||||
*
|
||||
* // Accept: text/*;q=.5, application/json
|
||||
* this.types(['html', 'json']);
|
||||
* this.types('html', 'json');
|
||||
* // => "json"
|
||||
*
|
||||
* @param {String|Array} types...
|
||||
* @return {String|Array|Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.type =
|
||||
Accepts.prototype.types = function (types_) {
|
||||
var types = types_
|
||||
|
||||
// support flattened arguments
|
||||
if (types && !Array.isArray(types)) {
|
||||
types = new Array(arguments.length)
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no types, return all requested types
|
||||
if (!types || types.length === 0) {
|
||||
return this.negotiator.mediaTypes()
|
||||
}
|
||||
|
||||
if (!this.headers.accept) return types[0];
|
||||
var mimes = types.map(extToMime);
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime));
|
||||
var first = accepts[0];
|
||||
if (!first) return false;
|
||||
return types[mimes.indexOf(first)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted encodings or best fit based on `encodings`.
|
||||
*
|
||||
* Given `Accept-Encoding: gzip, deflate`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['gzip', 'deflate']
|
||||
*
|
||||
* @param {String|Array} encodings...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.encoding =
|
||||
Accepts.prototype.encodings = function (encodings_) {
|
||||
var encodings = encodings_
|
||||
|
||||
// support flattened arguments
|
||||
if (encodings && !Array.isArray(encodings)) {
|
||||
encodings = new Array(arguments.length)
|
||||
for (var i = 0; i < encodings.length; i++) {
|
||||
encodings[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no encodings, return all requested encodings
|
||||
if (!encodings || encodings.length === 0) {
|
||||
return this.negotiator.encodings()
|
||||
}
|
||||
|
||||
return this.negotiator.encodings(encodings)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted charsets or best fit based on `charsets`.
|
||||
*
|
||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||
*
|
||||
* @param {String|Array} charsets...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.charset =
|
||||
Accepts.prototype.charsets = function (charsets_) {
|
||||
var charsets = charsets_
|
||||
|
||||
// support flattened arguments
|
||||
if (charsets && !Array.isArray(charsets)) {
|
||||
charsets = new Array(arguments.length)
|
||||
for (var i = 0; i < charsets.length; i++) {
|
||||
charsets[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no charsets, return all requested charsets
|
||||
if (!charsets || charsets.length === 0) {
|
||||
return this.negotiator.charsets()
|
||||
}
|
||||
|
||||
return this.negotiator.charsets(charsets)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted languages or best fit based on `langs`.
|
||||
*
|
||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['es', 'pt', 'en']
|
||||
*
|
||||
* @param {String|Array} langs...
|
||||
* @return {Array|String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.lang =
|
||||
Accepts.prototype.langs =
|
||||
Accepts.prototype.language =
|
||||
Accepts.prototype.languages = function (languages_) {
|
||||
var languages = languages_
|
||||
|
||||
// support flattened arguments
|
||||
if (languages && !Array.isArray(languages)) {
|
||||
languages = new Array(arguments.length)
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
languages[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no languages, return all requested languages
|
||||
if (!languages || languages.length === 0) {
|
||||
return this.negotiator.languages()
|
||||
}
|
||||
|
||||
return this.negotiator.languages(languages)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert extnames to mime.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function extToMime(type) {
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mime is valid.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function validMime(type) {
|
||||
return typeof type === 'string';
|
||||
}
|
76
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/HISTORY.md
generated
vendored
Normal file
76
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
0.5.3 / 2015-05-10
|
||||
==================
|
||||
|
||||
* Fix media type parameter matching to be case-insensitive
|
||||
|
||||
0.5.2 / 2015-05-06
|
||||
==================
|
||||
|
||||
* Fix comparing media types with quoted values
|
||||
* Fix splitting media types with quoted commas
|
||||
|
||||
0.5.1 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
0.5.0 / 2014-12-18
|
||||
==================
|
||||
|
||||
* Fix list return order when large accepted list
|
||||
* Fix missing identity encoding when q=0 exists
|
||||
* Remove dynamic building of Negotiator class
|
||||
|
||||
0.4.9 / 2014-10-14
|
||||
==================
|
||||
|
||||
* Fix error when media type has invalid parameter
|
||||
|
||||
0.4.8 / 2014-09-28
|
||||
==================
|
||||
|
||||
* Fix all negotiations to be case-insensitive
|
||||
* Stable sort preferences of same quality according to client order
|
||||
* Support Node.js 0.6
|
||||
|
||||
0.4.7 / 2014-06-24
|
||||
==================
|
||||
|
||||
* Handle invalid provided languages
|
||||
* Handle invalid provided media types
|
||||
|
||||
0.4.6 / 2014-06-11
|
||||
==================
|
||||
|
||||
* Order by specificity when quality is the same
|
||||
|
||||
0.4.5 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix regression in empty header handling
|
||||
|
||||
0.4.4 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix behaviors when headers are not present
|
||||
|
||||
0.4.3 / 2014-04-16
|
||||
==================
|
||||
|
||||
* Handle slashes on media params correctly
|
||||
|
||||
0.4.2 / 2014-02-28
|
||||
==================
|
||||
|
||||
* Fix media type sorting
|
||||
* Handle media types params strictly
|
||||
|
||||
0.4.1 / 2014-01-16
|
||||
==================
|
||||
|
||||
* Use most specific matches
|
||||
|
||||
0.4.0 / 2014-01-09
|
||||
==================
|
||||
|
||||
* Remove preferred prefix from methods
|
24
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/LICENSE
generated
vendored
Normal file
24
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 Federico Romero
|
||||
Copyright (c) 2012-2014 Isaac Z. Schlueter
|
||||
Copyright (c) 2014-2015 Douglas Christopher Wilson
|
||||
|
||||
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.
|
203
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/README.md
generated
vendored
Normal file
203
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/README.md
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
# negotiator
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
An HTTP content negotiator for Node.js
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install negotiator
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var Negotiator = require('negotiator')
|
||||
```
|
||||
|
||||
### Accept Negotiation
|
||||
|
||||
```js
|
||||
availableMediaTypes = ['text/html', 'text/plain', 'application/json']
|
||||
|
||||
// The negotiator constructor receives a request object
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'
|
||||
|
||||
negotiator.mediaTypes()
|
||||
// -> ['text/html', 'image/jpeg', 'application/*']
|
||||
|
||||
negotiator.mediaTypes(availableMediaTypes)
|
||||
// -> ['text/html', 'application/json']
|
||||
|
||||
negotiator.mediaType(availableMediaTypes)
|
||||
// -> 'text/html'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/accept.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### mediaType()
|
||||
|
||||
Returns the most preferred media type from the client.
|
||||
|
||||
##### mediaType(availableMediaType)
|
||||
|
||||
Returns the most preferred media type from a list of available media types.
|
||||
|
||||
##### mediaTypes()
|
||||
|
||||
Returns an array of preferred media types ordered by the client preference.
|
||||
|
||||
##### mediaTypes(availableMediaTypes)
|
||||
|
||||
Returns an array of preferred media types ordered by priority from a list of
|
||||
available media types.
|
||||
|
||||
### Accept-Language Negotiation
|
||||
|
||||
```js
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
availableLanguages = 'en', 'es', 'fr'
|
||||
|
||||
// Let's say Accept-Language header is 'en;q=0.8, es, pt'
|
||||
|
||||
negotiator.languages()
|
||||
// -> ['es', 'pt', 'en']
|
||||
|
||||
negotiator.languages(availableLanguages)
|
||||
// -> ['es', 'en']
|
||||
|
||||
language = negotiator.language(availableLanguages)
|
||||
// -> 'es'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/language.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### language()
|
||||
|
||||
Returns the most preferred language from the client.
|
||||
|
||||
##### language(availableLanguages)
|
||||
|
||||
Returns the most preferred language from a list of available languages.
|
||||
|
||||
##### languages()
|
||||
|
||||
Returns an array of preferred languages ordered by the client preference.
|
||||
|
||||
##### languages(availableLanguages)
|
||||
|
||||
Returns an array of preferred languages ordered by priority from a list of
|
||||
available languages.
|
||||
|
||||
### Accept-Charset Negotiation
|
||||
|
||||
```js
|
||||
availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']
|
||||
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'
|
||||
|
||||
negotiator.charsets()
|
||||
// -> ['utf-8', 'iso-8859-1', 'utf-7']
|
||||
|
||||
negotiator.charsets(availableCharsets)
|
||||
// -> ['utf-8', 'iso-8859-1']
|
||||
|
||||
negotiator.charset(availableCharsets)
|
||||
// -> 'utf-8'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/charset.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### charset()
|
||||
|
||||
Returns the most preferred charset from the client.
|
||||
|
||||
##### charset(availableCharsets)
|
||||
|
||||
Returns the most preferred charset from a list of available charsets.
|
||||
|
||||
##### charsets()
|
||||
|
||||
Returns an array of preferred charsets ordered by the client preference.
|
||||
|
||||
##### charsets(availableCharsets)
|
||||
|
||||
Returns an array of preferred charsets ordered by priority from a list of
|
||||
available charsets.
|
||||
|
||||
### Accept-Encoding Negotiation
|
||||
|
||||
```js
|
||||
availableEncodings = ['identity', 'gzip']
|
||||
|
||||
negotiator = new Negotiator(request)
|
||||
|
||||
// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'
|
||||
|
||||
negotiator.encodings()
|
||||
// -> ['gzip', 'identity', 'compress']
|
||||
|
||||
negotiator.encodings(availableEncodings)
|
||||
// -> ['gzip', 'identity']
|
||||
|
||||
negotiator.encoding(availableEncodings)
|
||||
// -> 'gzip'
|
||||
```
|
||||
|
||||
You can check a working example at `examples/encoding.js`.
|
||||
|
||||
#### Methods
|
||||
|
||||
##### encoding()
|
||||
|
||||
Returns the most preferred encoding from the client.
|
||||
|
||||
##### encoding(availableEncodings)
|
||||
|
||||
Returns the most preferred encoding from a list of available encodings.
|
||||
|
||||
##### encodings()
|
||||
|
||||
Returns an array of preferred encodings ordered by the client preference.
|
||||
|
||||
##### encodings(availableEncodings)
|
||||
|
||||
Returns an array of preferred encodings ordered by priority from a list of
|
||||
available encodings.
|
||||
|
||||
## See Also
|
||||
|
||||
The [accepts](https://npmjs.org/package/accepts#readme) module builds on
|
||||
this module and provides an alternative interface, mime type validation,
|
||||
and more.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/negotiator.svg
|
||||
[npm-url]: https://npmjs.org/package/negotiator
|
||||
[node-version-image]: https://img.shields.io/node/v/negotiator.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/negotiator/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/negotiator
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg
|
||||
[downloads-url]: https://npmjs.org/package/negotiator
|
62
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/index.js
generated
vendored
Normal file
62
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
var preferredCharsets = require('./lib/charset');
|
||||
var preferredEncodings = require('./lib/encoding');
|
||||
var preferredLanguages = require('./lib/language');
|
||||
var preferredMediaTypes = require('./lib/mediaType');
|
||||
|
||||
module.exports = Negotiator;
|
||||
Negotiator.Negotiator = Negotiator;
|
||||
|
||||
function Negotiator(request) {
|
||||
if (!(this instanceof Negotiator)) {
|
||||
return new Negotiator(request);
|
||||
}
|
||||
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
Negotiator.prototype.charset = function charset(available) {
|
||||
var set = this.charsets(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.charsets = function charsets(available) {
|
||||
return preferredCharsets(this.request.headers['accept-charset'], available);
|
||||
};
|
||||
|
||||
Negotiator.prototype.encoding = function encoding(available) {
|
||||
var set = this.encodings(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.encodings = function encodings(available) {
|
||||
return preferredEncodings(this.request.headers['accept-encoding'], available);
|
||||
};
|
||||
|
||||
Negotiator.prototype.language = function language(available) {
|
||||
var set = this.languages(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.languages = function languages(available) {
|
||||
return preferredLanguages(this.request.headers['accept-language'], available);
|
||||
};
|
||||
|
||||
Negotiator.prototype.mediaType = function mediaType(available) {
|
||||
var set = this.mediaTypes(available);
|
||||
return set && set[0];
|
||||
};
|
||||
|
||||
Negotiator.prototype.mediaTypes = function mediaTypes(available) {
|
||||
return preferredMediaTypes(this.request.headers.accept, available);
|
||||
};
|
||||
|
||||
// Backwards compatibility
|
||||
Negotiator.prototype.preferredCharset = Negotiator.prototype.charset;
|
||||
Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets;
|
||||
Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding;
|
||||
Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings;
|
||||
Negotiator.prototype.preferredLanguage = Negotiator.prototype.language;
|
||||
Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages;
|
||||
Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType;
|
||||
Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes;
|
112
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/package.json
generated
vendored
Normal file
112
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/node_modules/negotiator/package.json
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"negotiator@0.5.3",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/accepts"
|
||||
]
|
||||
],
|
||||
"_from": "negotiator@0.5.3",
|
||||
"_id": "negotiator@0.5.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/accepts/negotiator",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "negotiator",
|
||||
"raw": "negotiator@0.5.3",
|
||||
"rawSpec": "0.5.3",
|
||||
"scope": null,
|
||||
"spec": "0.5.3",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/accepts"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.5.3.tgz",
|
||||
"_shasum": "269d5c476810ec92edbe7b6c2f28316384f9a7e8",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "negotiator@0.5.3",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/accepts",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/negotiator/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "Douglas Christopher Wilson"
|
||||
},
|
||||
{
|
||||
"email": "federico.romero@outboxlabs.com",
|
||||
"name": "Federico Romero"
|
||||
},
|
||||
{
|
||||
"email": "i@izs.me",
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"url": "http://blog.izs.me/"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "HTTP content negotiation",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "~1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "269d5c476810ec92edbe7b6c2f28316384f9a7e8",
|
||||
"tarball": "https://registry.npmjs.org/negotiator/-/negotiator-0.5.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"README.md"
|
||||
],
|
||||
"gitHead": "cbb717b3f164f25820f90b160cda6d0166b9d922",
|
||||
"homepage": "https://github.com/jshttp/negotiator",
|
||||
"keywords": [
|
||||
"http",
|
||||
"content negotiation",
|
||||
"accept",
|
||||
"accept-language",
|
||||
"accept-encoding",
|
||||
"accept-charset"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "federomero@gmail.com",
|
||||
"name": "federomero"
|
||||
},
|
||||
{
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
{
|
||||
"email": "jonathanrichardong@gmail.com",
|
||||
"name": "jongleberry"
|
||||
}
|
||||
],
|
||||
"name": "negotiator",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/negotiator.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "0.5.3"
|
||||
}
|
123
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/package.json
generated
vendored
Normal file
123
ng2-components/ng2-alfresco-documentslist/dist/node_modules/accepts/package.json
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"accepts@~1.2.13",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/serve-index"
|
||||
]
|
||||
],
|
||||
"_from": "accepts@>=1.2.13 <1.3.0",
|
||||
"_id": "accepts@1.2.13",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/accepts",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "accepts",
|
||||
"raw": "accepts@~1.2.13",
|
||||
"rawSpec": "~1.2.13",
|
||||
"scope": null,
|
||||
"spec": ">=1.2.13 <1.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/serve-index"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.2.13.tgz",
|
||||
"_shasum": "e5f1f3928c6d95fd96558c36ec3d9d0de4a6ecea",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "accepts@~1.2.13",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/serve-index",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/accepts/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "Douglas Christopher Wilson"
|
||||
},
|
||||
{
|
||||
"email": "me@jongleberry.com",
|
||||
"name": "Jonathan Ong",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.6",
|
||||
"negotiator": "0.5.3"
|
||||
},
|
||||
"description": "Higher-level content negotiation",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.19",
|
||||
"mocha": "~1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "e5f1f3928c6d95fd96558c36ec3d9d0de4a6ecea",
|
||||
"tarball": "https://registry.npmjs.org/accepts/-/accepts-1.2.13.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "b7e15ecb25dacc0b2133ed0553d64f8a79537e01",
|
||||
"homepage": "https://github.com/jshttp/accepts",
|
||||
"keywords": [
|
||||
"content",
|
||||
"negotiation",
|
||||
"accept",
|
||||
"accepts"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "jonathanrichardong@gmail.com",
|
||||
"name": "jongleberry"
|
||||
},
|
||||
{
|
||||
"email": "federomero@gmail.com",
|
||||
"name": "federomero"
|
||||
},
|
||||
{
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
{
|
||||
"email": "fishrock123@rocketmail.com",
|
||||
"name": "fishrock123"
|
||||
},
|
||||
{
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "tjholowaychuk"
|
||||
},
|
||||
{
|
||||
"email": "mscdex@mscdex.net",
|
||||
"name": "mscdex"
|
||||
},
|
||||
{
|
||||
"email": "shtylman@gmail.com",
|
||||
"name": "defunctzombie"
|
||||
}
|
||||
],
|
||||
"name": "accepts",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/accepts.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "1.2.13"
|
||||
}
|
38
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/AUTHORS
generated
vendored
Normal file
38
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/AUTHORS
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
List of Acorn contributors. Updated before every release.
|
||||
|
||||
Adrian Rakovsky
|
||||
Alistair Braidwood
|
||||
Andres Suarez
|
||||
Aparajita Fishman
|
||||
Arian Stolwijk
|
||||
Artem Govorov
|
||||
Brandon Mills
|
||||
Charles Hughes
|
||||
Conrad Irwin
|
||||
David Bonnet
|
||||
Forbes Lindesay
|
||||
Gilad Peleg
|
||||
impinball
|
||||
Ingvar Stepanyan
|
||||
Jiaxing Wang
|
||||
Johannes Herr
|
||||
Jürg Lehni
|
||||
keeyipchan
|
||||
krator
|
||||
Marijn Haverbeke
|
||||
Martin Carlberg
|
||||
Mathias Bynens
|
||||
Mathieu 'p01' Henri
|
||||
Max Schaefer
|
||||
Max Zerzouri
|
||||
Mihai Bazon
|
||||
Mike Rennie
|
||||
Nick Fitzgerald
|
||||
Oskar Schöldström
|
||||
Paul Harper
|
||||
Peter Rust
|
||||
PlNG
|
||||
r-e-d
|
||||
Rich Harris
|
||||
Sebastian McKenzie
|
||||
zsjforcn
|
19
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/LICENSE
generated
vendored
Normal file
19
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2012-2014 by various contributors (see AUTHORS)
|
||||
|
||||
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.
|
377
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/README.md
generated
vendored
Normal file
377
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/README.md
generated
vendored
Normal file
@@ -0,0 +1,377 @@
|
||||
# Acorn
|
||||
|
||||
[](https://travis-ci.org/marijnh/acorn)
|
||||
[](https://www.npmjs.org/package/acorn)
|
||||
[Author funding status: ](https://marijnhaverbeke.nl/fund/)
|
||||
|
||||
A tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is with [`npm`][npm].
|
||||
|
||||
[npm]: http://npmjs.org
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, download the source.
|
||||
|
||||
```sh
|
||||
git clone https://github.com/marijnh/acorn.git
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
When run in a CommonJS (node.js) or AMD environment, exported values
|
||||
appear in the interfaces exposed by the individual files, as usual.
|
||||
When loaded in the browser (Acorn works in any JS-enabled browser more
|
||||
recent than IE5) without any kind of module management, a single
|
||||
global object `acorn` will be defined, and all the exported properties
|
||||
will be added to that.
|
||||
|
||||
### Main parser
|
||||
|
||||
This is implemented in `dist/acorn.js`, and is what you get when you
|
||||
`require("acorn")` in node.js.
|
||||
|
||||
**parse**`(input, options)` is used to parse a JavaScript program.
|
||||
The `input` parameter is a string, `options` can be undefined or an
|
||||
object setting some of the options listed below. The return value will
|
||||
be an abstract syntax tree object as specified by the
|
||||
[Mozilla Parser API][mozapi].
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the character offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
[mozapi]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, or 6. This influences support for strict mode, the set
|
||||
of reserved words, and support for new syntax features. Default is 5.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true`. When given the value `"never"`,
|
||||
reserved words and keywords can also not be used as property names
|
||||
(as in Internet Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed.
|
||||
|
||||
- **allowHashBang**: When this is enabled (off by default), if the
|
||||
code starts with the characters `#!` (as in a shellscript), the
|
||||
first line will be treated as a comment.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as `tokenize()` returns.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"range": ...,
|
||||
"loc": ...
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a [semi-standardized][range] "range" property holding a
|
||||
`[start, end]` array with the same numbers, set the `ranges` option
|
||||
to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added directly to the nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
[range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and character offset.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenize(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenize(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
#### Note on using with [Escodegen][escodegen]
|
||||
|
||||
Escodegen supports generating comments from AST, attached in
|
||||
Esprima-specific format. In order to simulate same format in
|
||||
Acorn, consider following example:
|
||||
|
||||
```javascript
|
||||
var comments = [], tokens = [];
|
||||
|
||||
var ast = acorn.parse('var x = 42; // answer', {
|
||||
// collect ranges for each node
|
||||
ranges: true,
|
||||
// collect comments in Esprima's format
|
||||
onComment: comments,
|
||||
// collect token ranges
|
||||
onToken: tokens
|
||||
});
|
||||
|
||||
// attach comments using collected information
|
||||
escodegen.attachComments(ast, comments, tokens);
|
||||
|
||||
// generate code
|
||||
console.log(escodegen.generate(ast, {comment: true}));
|
||||
// > 'var x = 42; // answer'
|
||||
```
|
||||
|
||||
[escodegen]: https://github.com/Constellation/escodegen
|
||||
|
||||
#### Using Acorn in an environment with a Content Security Policy
|
||||
|
||||
Some contexts, such as Chrome Web Apps, disallow run-time code evaluation.
|
||||
Acorn uses `new Function` to generate fast functions that test whether
|
||||
a word is in a given set, and will trigger a security error when used
|
||||
in a context with such a
|
||||
[Content Security Policy](http://www.html5rocks.com/en/tutorials/security/content-security-policy/#eval-too)
|
||||
(see [#90](https://github.com/marijnh/acorn/issues/90) and
|
||||
[#123](https://github.com/marijnh/acorn/issues/123)).
|
||||
|
||||
The `dist/acorn_csp.js` file in the distribution (which is built
|
||||
by the `bin/without_eval` script) has the generated code inlined, and
|
||||
can thus run without evaluating anything.
|
||||
|
||||
### dist/acorn_loose.js ###
|
||||
|
||||
This file implements an error-tolerant parser. It exposes a single
|
||||
function.
|
||||
|
||||
**parse_dammit**`(input, options)` takes the same arguments and
|
||||
returns the same syntax tree as the `parse` function in `acorn.js`,
|
||||
but never raises an error, and will do its best to parse syntactically
|
||||
invalid code in as meaningful a way as it can. It'll insert identifier
|
||||
nodes with name `"✖"` as placeholders in places where it can't make
|
||||
sense of the input. Depends on `acorn.js`, because it uses the same
|
||||
tokenizer.
|
||||
|
||||
### dist/walk.js ###
|
||||
|
||||
Implements an abstract syntax tree walker. Will store its interface in
|
||||
`acorn.walk` when loaded without a module system.
|
||||
|
||||
**simple**`(node, visitors, base, state)` does a 'simple' walk over
|
||||
a tree. `node` should be the AST node to walk, and `visitors` an
|
||||
object with properties whose names correspond to node types in the
|
||||
[Mozilla Parser API][mozapi]. The properties should contain functions
|
||||
that will be called with the node object and, if applicable the state
|
||||
at that point. The last two arguments are optional. `base` is a walker
|
||||
algorithm, and `state` is a start state. The default walker will
|
||||
simply visit all statements and expressions and not produce a
|
||||
meaningful state. (An example of a use of state it to track scope at
|
||||
each point in the tree.)
|
||||
|
||||
**ancestor**`(node, visitors, base, state)` does a 'simple' walk over
|
||||
a tree, building up an array of ancestor nodes (including the current node)
|
||||
and passing the array to callbacks in the `state` parameter.
|
||||
|
||||
**recursive**`(node, state, functions, base)` does a 'recursive'
|
||||
walk, where the walker functions are responsible for continuing the
|
||||
walk on the child nodes of their target node. `state` is the start
|
||||
state, and `functions` should contain an object that maps node types
|
||||
to walker functions. Such functions are called with `(node, state, c)`
|
||||
arguments, and can cause the walk to continue on a sub-node by calling
|
||||
the `c` argument on it with `(node, state)` arguments. The optional
|
||||
`base` argument provides the fallback walker functions for node types
|
||||
that aren't handled in the `functions` object. If not given, the
|
||||
default walkers will be used.
|
||||
|
||||
**make**`(functions, base)` builds a new walker object by using the
|
||||
walker functions in `functions` and filling in the missing ones by
|
||||
taking defaults from `base`.
|
||||
|
||||
**findNodeAt**`(node, start, end, test, base, state)` tries to
|
||||
locate a node in a tree at the given start and/or end offsets, which
|
||||
satisfies the predicate `test`. `start` end `end` can be either `null`
|
||||
(as wildcard) or a number. `test` may be a string (indicating a node
|
||||
type) or a function that takes `(nodeType, node)` arguments and
|
||||
returns a boolean indicating whether this node is interesting. `base`
|
||||
and `state` are optional, and can be used to specify a custom walker.
|
||||
Nodes are tested from inner to outer, so if two nodes match the
|
||||
boundaries, the inner one will be preferred.
|
||||
|
||||
**findNodeAround**`(node, pos, test, base, state)` is a lot like
|
||||
`findNodeAt`, but will match any node that exists 'around' (spanning)
|
||||
the given position.
|
||||
|
||||
**findNodeAfter**`(node, pos, test, base, state)` is similar to
|
||||
`findNodeAround`, but will match all nodes *after* the given position
|
||||
(testing outer nodes before inner nodes).
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6`: Sets the ECMAScript version to parse. Default is
|
||||
version 5.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Build system
|
||||
|
||||
Acorn is written in ECMAScript 6, as a set of small modules, in the
|
||||
project's `src` directory, and compiled down to bigger ECMAScript 3
|
||||
files in `dist` using [Browserify](http://browserify.org) and
|
||||
[Babel](http://babeljs.io/). If you are already using Babel, you can
|
||||
consider including the modules directly.
|
||||
|
||||
The command-line test runner (`npm test`) uses the ES6 modules. The
|
||||
browser-based test page (`test/index.html`) uses the compiled modules.
|
||||
The `bin/build-acorn.js` script builds the latter from the former.
|
||||
|
||||
If you are working on Acorn, you'll probably want to try the code out
|
||||
directly, without an intermediate build step. In your scripts, you can
|
||||
register the Babel require shim like this:
|
||||
|
||||
require("babelify/node_modules/babel-core/register")
|
||||
|
||||
That will allow you to directly `require` the ES6 modules.
|
||||
|
||||
## Plugins
|
||||
|
||||
Acorn is designed support allow plugins which, within reasonable
|
||||
bounds, redefine the way the parser works. Plugins can add new token
|
||||
types and new tokenizer contexts (if necessary), and extend methods in
|
||||
the parser object. This is not a clean, elegant API—using it requires
|
||||
an understanding of Acorn's internals, and plugins are likely to break
|
||||
whenever those internals are significantly changed. But still, it is
|
||||
_possible_, in this way, to create parsers for JavaScript dialects
|
||||
without forking all of Acorn. And in principle it is even possible to
|
||||
combine such plugins, so that if you have, for example, a plugin for
|
||||
parsing types and a plugin for parsing JSX-style XML literals, you
|
||||
could load them both and parse code with both JSX tags and types.
|
||||
|
||||
A plugin should register itself by adding a property to
|
||||
`acorn.plugins`, which holds a function. Calling `acorn.parse`, a
|
||||
`plugin` option can be passed, holding an object mapping plugin names
|
||||
to configuration values (or just `true` for plugins that don't take
|
||||
options). After the parser object has been created, the initialization
|
||||
functions for the chosen plugins are called with `(parser,
|
||||
configValue)` arguments. They are expected to use the `parser.extend`
|
||||
method to extend parser methods. For example, the `readToken` method
|
||||
could be extended like this:
|
||||
|
||||
```javascript
|
||||
parser.extend("readToken", function(nextMethod) {
|
||||
return function(code) {
|
||||
console.log("Reading a token!")
|
||||
return nextMethod.call(this, code)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
The `nextMethod` argument passed to `extend`'s second argument is the
|
||||
previous value of this method, and should usually be called through to
|
||||
whenever the extended method does not handle the call itself.
|
||||
|
||||
There is a proof-of-concept JSX plugin in the [`jsx`
|
||||
branch](https://github.com/marijnh/acorn/tree/jsx) branch of the
|
||||
Github repository.
|
54
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/acorn
generated
vendored
Executable file
54
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/acorn
generated
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var acorn = require("../dist/acorn.js");
|
||||
|
||||
var infile, parsed, tokens, options = {}, silent = false, compact = false, tokenize = false;
|
||||
|
||||
function help(status) {
|
||||
var print = (status == 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6]");
|
||||
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--help] [--] infile");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if (arg[0] != "-" && !infile) infile = arg;
|
||||
else if (arg == "--" && !infile && i + 2 == process.argv.length) infile = process.argv[++i];
|
||||
else if (arg == "--ecma3") options.ecmaVersion = 3;
|
||||
else if (arg == "--ecma5") options.ecmaVersion = 5;
|
||||
else if (arg == "--ecma6") options.ecmaVersion = 6;
|
||||
else if (arg == "--ecma7") options.ecmaVersion = 7;
|
||||
else if (arg == "--locations") options.locations = true;
|
||||
else if (arg == "--allow-hash-bang") options.allowHashBang = true;
|
||||
else if (arg == "--silent") silent = true;
|
||||
else if (arg == "--compact") compact = true;
|
||||
else if (arg == "--help") help(0);
|
||||
else if (arg == "--tokenize") tokenize = true;
|
||||
else help(1);
|
||||
}
|
||||
|
||||
try {
|
||||
var code = fs.readFileSync(infile, "utf8");
|
||||
|
||||
if (!tokenize)
|
||||
parsed = acorn.parse(code, options);
|
||||
else {
|
||||
var get = acorn.tokenize(code, options);
|
||||
tokens = [];
|
||||
while (true) {
|
||||
var token = get();
|
||||
tokens.push(token);
|
||||
if (token.type.type == "eof")
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
console.log(JSON.stringify(tokenize ? tokens : parsed, null, compact ? null : 2));
|
51
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/build-acorn.js
generated
vendored
Normal file
51
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/build-acorn.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
var fs = require("fs"), path = require("path")
|
||||
var stream = require("stream")
|
||||
|
||||
var browserify = require("browserify")
|
||||
var babelify = require("babelify").configure({loose: "all"})
|
||||
|
||||
process.chdir(path.resolve(__dirname, ".."))
|
||||
|
||||
browserify({standalone: "acorn"})
|
||||
.plugin(require('browserify-derequire'))
|
||||
.transform(babelify)
|
||||
.require("./src/index.js", {entry: true})
|
||||
.bundle()
|
||||
.on("error", function (err) { console.log("Error: " + err.message) })
|
||||
.pipe(fs.createWriteStream("dist/acorn.js"))
|
||||
|
||||
function acornShim(file) {
|
||||
var tr = new stream.Transform
|
||||
if (file == path.resolve(__dirname, "../src/index.js")) {
|
||||
var sent = false
|
||||
tr._transform = function(chunk, _, callback) {
|
||||
if (!sent) {
|
||||
sent = true
|
||||
callback(null, "module.exports = typeof acorn != 'undefined' ? acorn : _dereq_(\"./acorn\")")
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tr._transform = function(chunk, _, callback) { callback(null, chunk) }
|
||||
}
|
||||
return tr
|
||||
}
|
||||
|
||||
browserify({standalone: "acorn.loose"})
|
||||
.plugin(require('browserify-derequire'))
|
||||
.transform(acornShim)
|
||||
.transform(babelify)
|
||||
.require("./src/loose/index.js", {entry: true})
|
||||
.bundle()
|
||||
.on("error", function (err) { console.log("Error: " + err.message) })
|
||||
.pipe(fs.createWriteStream("dist/acorn_loose.js"))
|
||||
|
||||
browserify({standalone: "acorn.walk"})
|
||||
.plugin(require('browserify-derequire'))
|
||||
.transform(acornShim)
|
||||
.transform(babelify)
|
||||
.require("./src/walk/index.js", {entry: true})
|
||||
.bundle()
|
||||
.on("error", function (err) { console.log("Error: " + err.message) })
|
||||
.pipe(fs.createWriteStream("dist/walk.js"))
|
47
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/generate-identifier-regex.js
generated
vendored
Normal file
47
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/generate-identifier-regex.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// Note: run `npm install unicode-7.0.0` first.
|
||||
|
||||
// Which Unicode version should be used?
|
||||
var version = '7.0.0';
|
||||
|
||||
var start = require('unicode-' + version + '/properties/ID_Start/code-points')
|
||||
.filter(function(ch) { return ch > 127; });
|
||||
var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/properties/ID_Continue/code-points')
|
||||
.filter(function(ch) { return ch > 127 && start.indexOf(ch) == -1; }));
|
||||
|
||||
function pad(str, width) {
|
||||
while (str.length < width) str = "0" + str;
|
||||
return str;
|
||||
}
|
||||
|
||||
function esc(code) {
|
||||
var hex = code.toString(16);
|
||||
if (hex.length <= 2) return "\\x" + pad(hex, 2);
|
||||
else return "\\u" + pad(hex, 4);
|
||||
}
|
||||
|
||||
function generate(chars) {
|
||||
var astral = [], re = "";
|
||||
for (var i = 0, at = 0x10000; i < chars.length; i++) {
|
||||
var from = chars[i], to = from;
|
||||
while (i < chars.length - 1 && chars[i + 1] == to + 1) {
|
||||
i++;
|
||||
to++;
|
||||
}
|
||||
if (to <= 0xffff) {
|
||||
if (from == to) re += esc(from);
|
||||
else if (from + 1 == to) re += esc(from) + esc(to);
|
||||
else re += esc(from) + "-" + esc(to);
|
||||
} else {
|
||||
astral.push(from - at, to - from);
|
||||
at = to;
|
||||
}
|
||||
}
|
||||
return {nonASCII: re, astral: astral};
|
||||
}
|
||||
|
||||
var startData = generate(start), contData = generate(cont);
|
||||
|
||||
console.log(" var nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\";");
|
||||
console.log(" var nonASCIIidentifierChars = \"" + contData.nonASCII + "\";");
|
||||
console.log(" var astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";");
|
||||
console.log(" var astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";");
|
2
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/prepublish.sh
generated
vendored
Executable file
2
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/prepublish.sh
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
node bin/build-acorn.js
|
||||
node bin/without_eval > dist/acorn_csp.js
|
6
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/update_authors.sh
generated
vendored
Executable file
6
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/update_authors.sh
generated
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
# Combine existing list of authors with everyone known in git, sort, add header.
|
||||
tail --lines=+3 AUTHORS > AUTHORS.tmp
|
||||
git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp
|
||||
echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS
|
||||
sort -u AUTHORS.tmp >> AUTHORS
|
||||
rm -f AUTHORS.tmp
|
48
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/without_eval
generated
vendored
Executable file
48
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/bin/without_eval
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require("fs")
|
||||
|
||||
var acornSrc = fs.readFileSync(require.resolve("../dist/acorn"), "utf8")
|
||||
var acorn = require("../dist/acorn"), walk = require("../dist/walk")
|
||||
|
||||
var ast = acorn.parse(acornSrc)
|
||||
var touchups = [], uses = []
|
||||
|
||||
var makePred
|
||||
|
||||
walk.simple(ast, {
|
||||
FunctionDeclaration: function(node) {
|
||||
if (node.id.name == "makePredicate") {
|
||||
makePred = node
|
||||
touchups.push({text: "// Removed to create an eval-free library", from: node.start, to: node.end})
|
||||
}
|
||||
},
|
||||
ObjectExpression: function(node) {
|
||||
node.properties.forEach(function(prop) {
|
||||
if (prop.value.type == "CallExpression" &&
|
||||
prop.value.callee.name == "makePredicate")
|
||||
uses.push(prop.value)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
var results = []
|
||||
var dryRun = acornSrc.slice(0, makePred.end) + "; makePredicate = (function(mp) {" +
|
||||
"return function(words) { var r = mp(words); predicates.push(r); return r }})(makePredicate);" +
|
||||
acornSrc.slice(makePred.end)
|
||||
;(new Function("predicates", dryRun))(results)
|
||||
|
||||
uses.forEach(function (node, i) {
|
||||
touchups.push({text: results[i].toString(), from: node.start, to: node.end})
|
||||
})
|
||||
|
||||
var result = "", pos = 0
|
||||
touchups.sort(function(a, b) { return a.from - b.from })
|
||||
touchups.forEach(function(touchup) {
|
||||
result += acornSrc.slice(pos, touchup.from)
|
||||
result += touchup.text
|
||||
pos = touchup.to
|
||||
})
|
||||
result += acornSrc.slice(pos)
|
||||
|
||||
process.stdout.write(result)
|
4014
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
4014
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3985
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/acorn_csp.js
generated
vendored
Normal file
3985
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/acorn_csp.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1298
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/acorn_loose.js
generated
vendored
Normal file
1298
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/acorn_loose.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
342
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/walk.js
generated
vendored
Normal file
342
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/dist/walk.js
generated
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.acorn || (g.acorn = {})).walk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
"use strict";
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression,
|
||||
// Statement, and ScopeBody, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
|
||||
exports.simple = simple;
|
||||
|
||||
// An ancestor walk builds up an array of ancestor nodes (including
|
||||
// the current node) and passes them to the callback as the state parameter.
|
||||
exports.ancestor = ancestor;
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
exports.recursive = recursive;
|
||||
|
||||
// Find a node with a given start, end, and type (all are optional,
|
||||
// null can be used as wildcard). Returns a {node, state} object, or
|
||||
// undefined when it doesn't find a matching node.
|
||||
exports.findNodeAt = findNodeAt;
|
||||
|
||||
// Find the innermost node of a given type that contains the given
|
||||
// position. Interface similar to findNodeAt.
|
||||
exports.findNodeAround = findNodeAround;
|
||||
|
||||
// Find the outermost matching node after a given position.
|
||||
exports.findNodeAfter = findNodeAfter;
|
||||
|
||||
// Find the outermost matching node before a given position.
|
||||
exports.findNodeBefore = findNodeBefore;
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
exports.make = make;
|
||||
exports.__esModule = true;
|
||||
|
||||
function simple(node, visitors, base, state) {
|
||||
if (!base) base = exports.base;(function c(node, st, override) {
|
||||
var type = override || node.type,
|
||||
found = visitors[type];
|
||||
base[type](node, st, c);
|
||||
if (found) found(node, st);
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
function ancestor(node, visitors, base, state) {
|
||||
if (!base) base = exports.base;
|
||||
if (!state) state = [];(function c(node, st, override) {
|
||||
var type = override || node.type,
|
||||
found = visitors[type];
|
||||
if (node != st[st.length - 1]) {
|
||||
st = st.slice();
|
||||
st.push(node);
|
||||
}
|
||||
base[type](node, st, c);
|
||||
if (found) found(node, st);
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
function recursive(node, state, funcs, base) {
|
||||
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) {
|
||||
visitor[override || node.type](node, st, c);
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
function makeTest(test) {
|
||||
if (typeof test == "string") {
|
||||
return function (type) {
|
||||
return type == test;
|
||||
};
|
||||
} else if (!test) {
|
||||
return function () {
|
||||
return true;
|
||||
};
|
||||
} else {
|
||||
return test;
|
||||
}
|
||||
}
|
||||
|
||||
var Found = function Found(node, state) {
|
||||
_classCallCheck(this, Found);
|
||||
|
||||
this.node = node;this.state = state;
|
||||
};
|
||||
|
||||
function findNodeAt(node, start, end, test, base, state) {
|
||||
test = makeTest(test);
|
||||
if (!base) base = exports.base;
|
||||
try {
|
||||
;(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if ((start == null || node.start <= start) && (end == null || node.end >= end)) base[type](node, st, c);
|
||||
if (test(type, node) && (start == null || node.start == start) && (end == null || node.end == end)) throw new Found(node, st);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) {
|
||||
return e;
|
||||
}throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function findNodeAround(node, pos, test, base, state) {
|
||||
test = makeTest(test);
|
||||
if (!base) base = exports.base;
|
||||
try {
|
||||
;(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if (node.start > pos || node.end < pos) {
|
||||
return;
|
||||
}base[type](node, st, c);
|
||||
if (test(type, node)) throw new Found(node, st);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) {
|
||||
return e;
|
||||
}throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function findNodeAfter(node, pos, test, base, state) {
|
||||
test = makeTest(test);
|
||||
if (!base) base = exports.base;
|
||||
try {
|
||||
;(function c(node, st, override) {
|
||||
if (node.end < pos) {
|
||||
return;
|
||||
}var type = override || node.type;
|
||||
if (node.start >= pos && test(type, node)) throw new Found(node, st);
|
||||
base[type](node, st, c);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) {
|
||||
return e;
|
||||
}throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function findNodeBefore(node, pos, test, base, state) {
|
||||
test = makeTest(test);
|
||||
if (!base) base = exports.base;
|
||||
var max = undefined;(function c(node, st, override) {
|
||||
if (node.start > pos) {
|
||||
return;
|
||||
}var type = override || node.type;
|
||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) max = new Found(node, st);
|
||||
base[type](node, st, c);
|
||||
})(node, state);
|
||||
return max;
|
||||
}
|
||||
|
||||
function make(funcs, base) {
|
||||
if (!base) base = exports.base;
|
||||
var visitor = {};
|
||||
for (var type in base) visitor[type] = base[type];
|
||||
for (var type in funcs) visitor[type] = funcs[type];
|
||||
return visitor;
|
||||
}
|
||||
|
||||
function skipThrough(node, st, c) {
|
||||
c(node, st);
|
||||
}
|
||||
function ignore(_node, _st, _c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
var base = {};
|
||||
|
||||
exports.base = base;
|
||||
base.Program = base.BlockStatement = function (node, st, c) {
|
||||
for (var i = 0; i < node.body.length; ++i) {
|
||||
c(node.body[i], st, "Statement");
|
||||
}
|
||||
};
|
||||
base.Statement = skipThrough;
|
||||
base.EmptyStatement = ignore;
|
||||
base.ExpressionStatement = base.ParenthesizedExpression = function (node, st, c) {
|
||||
return c(node.expression, st, "Expression");
|
||||
};
|
||||
base.IfStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Statement");
|
||||
if (node.alternate) c(node.alternate, st, "Statement");
|
||||
};
|
||||
base.LabeledStatement = function (node, st, c) {
|
||||
return c(node.body, st, "Statement");
|
||||
};
|
||||
base.BreakStatement = base.ContinueStatement = ignore;
|
||||
base.WithStatement = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.SwitchStatement = function (node, st, c) {
|
||||
c(node.discriminant, st, "Expression");
|
||||
for (var i = 0; i < node.cases.length; ++i) {
|
||||
var cs = node.cases[i];
|
||||
if (cs.test) c(cs.test, st, "Expression");
|
||||
for (var j = 0; j < cs.consequent.length; ++j) {
|
||||
c(cs.consequent[j], st, "Statement");
|
||||
}
|
||||
}
|
||||
};
|
||||
base.ReturnStatement = base.YieldExpression = function (node, st, c) {
|
||||
if (node.argument) c(node.argument, st, "Expression");
|
||||
};
|
||||
base.ThrowStatement = base.SpreadElement = base.RestElement = function (node, st, c) {
|
||||
return c(node.argument, st, "Expression");
|
||||
};
|
||||
base.TryStatement = function (node, st, c) {
|
||||
c(node.block, st, "Statement");
|
||||
if (node.handler) c(node.handler.body, st, "ScopeBody");
|
||||
if (node.finalizer) c(node.finalizer, st, "Statement");
|
||||
};
|
||||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForStatement = function (node, st, c) {
|
||||
if (node.init) c(node.init, st, "ForInit");
|
||||
if (node.test) c(node.test, st, "Expression");
|
||||
if (node.update) c(node.update, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
||||
c(node.left, st, "ForInit");
|
||||
c(node.right, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInit = function (node, st, c) {
|
||||
if (node.type == "VariableDeclaration") c(node, st);else c(node, st, "Expression");
|
||||
};
|
||||
base.DebuggerStatement = ignore;
|
||||
|
||||
base.FunctionDeclaration = function (node, st, c) {
|
||||
return c(node, st, "Function");
|
||||
};
|
||||
base.VariableDeclaration = function (node, st, c) {
|
||||
for (var i = 0; i < node.declarations.length; ++i) {
|
||||
var decl = node.declarations[i];
|
||||
if (decl.init) c(decl.init, st, "Expression");
|
||||
}
|
||||
};
|
||||
|
||||
base.Function = function (node, st, c) {
|
||||
return c(node.body, st, "ScopeBody");
|
||||
};
|
||||
base.ScopeBody = function (node, st, c) {
|
||||
return c(node, st, "Statement");
|
||||
};
|
||||
|
||||
base.Expression = skipThrough;
|
||||
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
||||
base.ArrayExpression = base.ArrayPattern = function (node, st, c) {
|
||||
for (var i = 0; i < node.elements.length; ++i) {
|
||||
var elt = node.elements[i];
|
||||
if (elt) c(elt, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.ObjectExpression = base.ObjectPattern = function (node, st, c) {
|
||||
for (var i = 0; i < node.properties.length; ++i) {
|
||||
c(node.properties[i], st);
|
||||
}
|
||||
};
|
||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
||||
base.SequenceExpression = base.TemplateLiteral = function (node, st, c) {
|
||||
for (var i = 0; i < node.expressions.length; ++i) {
|
||||
c(node.expressions[i], st, "Expression");
|
||||
}
|
||||
};
|
||||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = function (node, st, c) {
|
||||
c(node.left, st, "Expression");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.ConditionalExpression = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Expression");
|
||||
c(node.alternate, st, "Expression");
|
||||
};
|
||||
base.NewExpression = base.CallExpression = function (node, st, c) {
|
||||
c(node.callee, st, "Expression");
|
||||
if (node.arguments) for (var i = 0; i < node.arguments.length; ++i) {
|
||||
c(node.arguments[i], st, "Expression");
|
||||
}
|
||||
};
|
||||
base.MemberExpression = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
if (node.computed) c(node.property, st, "Expression");
|
||||
};
|
||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
||||
return c(node.declaration, st);
|
||||
};
|
||||
base.ImportDeclaration = function (node, st, c) {
|
||||
for (var i = 0; i < node.specifiers.length; i++) {
|
||||
c(node.specifiers[i], st);
|
||||
}
|
||||
};
|
||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
||||
|
||||
base.TaggedTemplateExpression = function (node, st, c) {
|
||||
c(node.tag, st, "Expression");
|
||||
c(node.quasi, st);
|
||||
};
|
||||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) {
|
||||
if (node.superClass) c(node.superClass, st, "Expression");
|
||||
for (var i = 0; i < node.body.body.length; i++) {
|
||||
c(node.body.body[i], st);
|
||||
}
|
||||
};
|
||||
base.MethodDefinition = base.Property = function (node, st, c) {
|
||||
if (node.computed) c(node.key, st, "Expression");
|
||||
c(node.value, st, "Expression");
|
||||
};
|
||||
base.ComprehensionExpression = function (node, st, c) {
|
||||
for (var i = 0; i < node.blocks.length; i++) {
|
||||
c(node.blocks[i].right, st, "Expression");
|
||||
}c(node.body, st, "Expression");
|
||||
};
|
||||
|
||||
},{}]},{},[1])(1)
|
||||
});
|
192
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/package.json
generated
vendored
Normal file
192
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/package.json
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"acorn@^1.0.3",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/falafel"
|
||||
]
|
||||
],
|
||||
"_from": "acorn@>=1.0.3 <2.0.0",
|
||||
"_id": "acorn@1.2.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/acorn",
|
||||
"_npmUser": {
|
||||
"email": "marijnh@gmail.com",
|
||||
"name": "marijn"
|
||||
},
|
||||
"_npmVersion": "1.4.21",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "acorn",
|
||||
"raw": "acorn@^1.0.3",
|
||||
"rawSpec": "^1.0.3",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/falafel"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz",
|
||||
"_shasum": "c8ce27de0acc76d896d2b1fad3df588d9e82f014",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "acorn@^1.0.3",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/falafel",
|
||||
"bin": {
|
||||
"acorn": "./bin/acorn"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/marijnh/acorn/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "List of Acorn contributors. Updated before every release."
|
||||
},
|
||||
{
|
||||
"name": "Adrian Rakovsky"
|
||||
},
|
||||
{
|
||||
"name": "Alistair Braidwood"
|
||||
},
|
||||
{
|
||||
"name": "Andres Suarez"
|
||||
},
|
||||
{
|
||||
"name": "Aparajita Fishman"
|
||||
},
|
||||
{
|
||||
"name": "Arian Stolwijk"
|
||||
},
|
||||
{
|
||||
"name": "Artem Govorov"
|
||||
},
|
||||
{
|
||||
"name": "Brandon Mills"
|
||||
},
|
||||
{
|
||||
"name": "Charles Hughes"
|
||||
},
|
||||
{
|
||||
"name": "Conrad Irwin"
|
||||
},
|
||||
{
|
||||
"name": "David Bonnet"
|
||||
},
|
||||
{
|
||||
"name": "Forbes Lindesay"
|
||||
},
|
||||
{
|
||||
"name": "Gilad Peleg"
|
||||
},
|
||||
{
|
||||
"name": "impinball"
|
||||
},
|
||||
{
|
||||
"name": "Ingvar Stepanyan"
|
||||
},
|
||||
{
|
||||
"name": "Jiaxing Wang"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Herr"
|
||||
},
|
||||
{
|
||||
"name": "Jürg Lehni"
|
||||
},
|
||||
{
|
||||
"name": "keeyipchan"
|
||||
},
|
||||
{
|
||||
"name": "krator"
|
||||
},
|
||||
{
|
||||
"name": "Marijn Haverbeke"
|
||||
},
|
||||
{
|
||||
"name": "Martin Carlberg"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens"
|
||||
},
|
||||
{
|
||||
"name": "Mathieu 'p01' Henri"
|
||||
},
|
||||
{
|
||||
"name": "Max Schaefer"
|
||||
},
|
||||
{
|
||||
"name": "Max Zerzouri"
|
||||
},
|
||||
{
|
||||
"name": "Mihai Bazon"
|
||||
},
|
||||
{
|
||||
"name": "Mike Rennie"
|
||||
},
|
||||
{
|
||||
"name": "Nick Fitzgerald"
|
||||
},
|
||||
{
|
||||
"name": "Oskar Schöldström"
|
||||
},
|
||||
{
|
||||
"name": "Paul Harper"
|
||||
},
|
||||
{
|
||||
"name": "Peter Rust"
|
||||
},
|
||||
{
|
||||
"name": "PlNG"
|
||||
},
|
||||
{
|
||||
"name": "r-e-d"
|
||||
},
|
||||
{
|
||||
"name": "Rich Harris"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian McKenzie"
|
||||
},
|
||||
{
|
||||
"name": "zsjforcn"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "ECMAScript parser",
|
||||
"devDependencies": {
|
||||
"babelify": "^5.0.4",
|
||||
"browserify": "^9.0.3",
|
||||
"browserify-derequire": "^0.9.4",
|
||||
"unicode-7.0.0": "~0.1.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c8ce27de0acc76d896d2b1fad3df588d9e82f014",
|
||||
"tarball": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"gitHead": "0857d8bb9c3c05e6c8fac9e83fddaefc4f43816f",
|
||||
"homepage": "https://github.com/marijnh/acorn",
|
||||
"license": "MIT",
|
||||
"main": "dist/acorn.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "marijnh@gmail.com",
|
||||
"name": "marijn"
|
||||
}
|
||||
],
|
||||
"name": "acorn",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/marijnh/acorn.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "bin/prepublish.sh",
|
||||
"test": "node test/run.js"
|
||||
},
|
||||
"version": "1.2.2"
|
||||
}
|
697
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/expression.js
generated
vendored
Executable file
697
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/expression.js
generated
vendored
Executable file
@@ -0,0 +1,697 @@
|
||||
// A recursive descent parser operates by defining functions for all
|
||||
// syntactic elements, and recursively calling those, each function
|
||||
// advancing the input stream and returning an AST node. Precedence
|
||||
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
||||
// instead of `(!x)[1]` is handled by the fact that the parser
|
||||
// function that parses unary prefix operators is called first, and
|
||||
// in turn calls the function that parses `[]` subscripts — that
|
||||
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
||||
// *that* in the unary operator node.
|
||||
//
|
||||
// Acorn uses an [operator precedence parser][opp] to handle binary
|
||||
// operator precedence, because it is much more compact than using
|
||||
// the technique outlined above, which uses different, nesting
|
||||
// functions to specify precedence, for all of the ten binary
|
||||
// precedence levels that JavaScript defines.
|
||||
//
|
||||
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
||||
|
||||
import {types as tt} from "./tokentype"
|
||||
import {Parser} from "./state"
|
||||
import {reservedWords} from "./identifier"
|
||||
import {has} from "./util"
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
// Check if property name clashes with already added.
|
||||
// Object/class getters and setters are not allowed to clash —
|
||||
// either with each other or with an init property — and in
|
||||
// strict mode, init properties are also not allowed to be repeated.
|
||||
|
||||
pp.checkPropClash = function(prop, propHash) {
|
||||
if (this.options.ecmaVersion >= 6) return
|
||||
let key = prop.key, name
|
||||
switch (key.type) {
|
||||
case "Identifier": name = key.name; break
|
||||
case "Literal": name = String(key.value); break
|
||||
default: return
|
||||
}
|
||||
let kind = prop.kind || "init", other
|
||||
if (has(propHash, name)) {
|
||||
other = propHash[name]
|
||||
let isGetSet = kind !== "init"
|
||||
if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init))
|
||||
this.raise(key.start, "Redefinition of property")
|
||||
} else {
|
||||
other = propHash[name] = {
|
||||
init: false,
|
||||
get: false,
|
||||
set: false
|
||||
}
|
||||
}
|
||||
other[kind] = true
|
||||
}
|
||||
|
||||
// ### Expression parsing
|
||||
|
||||
// These nest, from the most general expression type at the top to
|
||||
// 'atomic', nondivisible expression types at the bottom. Most of
|
||||
// the functions will simply let the function(s) below them parse,
|
||||
// and, *if* the syntactic construct they handle is present, wrap
|
||||
// the AST node that the inner parser gave them in another node.
|
||||
|
||||
// Parse a full expression. The optional arguments are used to
|
||||
// forbid the `in` operator (in for loops initalization expressions)
|
||||
// and provide reference for storing '=' operator inside shorthand
|
||||
// property assignment in contexts where both object expression
|
||||
// and object pattern might appear (so it's possible to raise
|
||||
// delayed syntax error at correct position).
|
||||
|
||||
pp.parseExpression = function(noIn, refShorthandDefaultPos) {
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
let expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos)
|
||||
if (this.type === tt.comma) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.expressions = [expr]
|
||||
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos))
|
||||
return this.finishNode(node, "SequenceExpression")
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
// Parse an assignment expression. This includes applications of
|
||||
// operators like `+=`.
|
||||
|
||||
pp.parseMaybeAssign = function(noIn, refShorthandDefaultPos, afterLeftParse) {
|
||||
if (this.type == tt._yield && this.inGenerator) return this.parseYield()
|
||||
|
||||
let failOnShorthandAssign
|
||||
if (!refShorthandDefaultPos) {
|
||||
refShorthandDefaultPos = {start: 0}
|
||||
failOnShorthandAssign = true
|
||||
} else {
|
||||
failOnShorthandAssign = false
|
||||
}
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
if (this.type == tt.parenL || this.type == tt.name)
|
||||
this.potentialArrowAt = this.start
|
||||
let left = this.parseMaybeConditional(noIn, refShorthandDefaultPos)
|
||||
if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc)
|
||||
if (this.type.isAssign) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.operator = this.value
|
||||
node.left = this.type === tt.eq ? this.toAssignable(left) : left
|
||||
refShorthandDefaultPos.start = 0 // reset because shorthand default was used correctly
|
||||
this.checkLVal(left)
|
||||
this.next()
|
||||
node.right = this.parseMaybeAssign(noIn)
|
||||
return this.finishNode(node, "AssignmentExpression")
|
||||
} else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
|
||||
this.unexpected(refShorthandDefaultPos.start)
|
||||
}
|
||||
return left
|
||||
}
|
||||
|
||||
// Parse a ternary conditional (`?:`) operator.
|
||||
|
||||
pp.parseMaybeConditional = function(noIn, refShorthandDefaultPos) {
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
let expr = this.parseExprOps(noIn, refShorthandDefaultPos)
|
||||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
|
||||
if (this.eat(tt.question)) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.test = expr
|
||||
node.consequent = this.parseMaybeAssign()
|
||||
this.expect(tt.colon)
|
||||
node.alternate = this.parseMaybeAssign(noIn)
|
||||
return this.finishNode(node, "ConditionalExpression")
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
// Start the precedence parser.
|
||||
|
||||
pp.parseExprOps = function(noIn, refShorthandDefaultPos) {
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
let expr = this.parseMaybeUnary(refShorthandDefaultPos)
|
||||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
|
||||
return this.parseExprOp(expr, startPos, startLoc, -1, noIn)
|
||||
}
|
||||
|
||||
// Parse binary operators with the operator precedence parsing
|
||||
// algorithm. `left` is the left-hand side of the operator.
|
||||
// `minPrec` provides context that allows the function to stop and
|
||||
// defer further parser to one of its callers when it encounters an
|
||||
// operator that has a lower precedence than the set it is parsing.
|
||||
|
||||
pp.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
|
||||
let prec = this.type.binop
|
||||
if (Array.isArray(leftStartPos)){
|
||||
if (this.options.locations && noIn === undefined) {
|
||||
// shift arguments to left by one
|
||||
noIn = minPrec
|
||||
minPrec = leftStartLoc
|
||||
// flatten leftStartPos
|
||||
leftStartLoc = leftStartPos[1]
|
||||
leftStartPos = leftStartPos[0]
|
||||
}
|
||||
}
|
||||
if (prec != null && (!noIn || this.type !== tt._in)) {
|
||||
if (prec > minPrec) {
|
||||
let node = this.startNodeAt(leftStartPos, leftStartLoc)
|
||||
node.left = left
|
||||
node.operator = this.value
|
||||
let op = this.type
|
||||
this.next()
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn)
|
||||
this.finishNode(node, (op === tt.logicalOR || op === tt.logicalAND) ? "LogicalExpression" : "BinaryExpression")
|
||||
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
|
||||
}
|
||||
}
|
||||
return left
|
||||
}
|
||||
|
||||
// Parse unary operators, both prefix and postfix.
|
||||
|
||||
pp.parseMaybeUnary = function(refShorthandDefaultPos) {
|
||||
if (this.type.prefix) {
|
||||
let node = this.startNode(), update = this.type === tt.incDec
|
||||
node.operator = this.value
|
||||
node.prefix = true
|
||||
this.next()
|
||||
node.argument = this.parseMaybeUnary()
|
||||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start)
|
||||
if (update) this.checkLVal(node.argument)
|
||||
else if (this.strict && node.operator === "delete" &&
|
||||
node.argument.type === "Identifier")
|
||||
this.raise(node.start, "Deleting local variable in strict mode")
|
||||
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
|
||||
}
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
let expr = this.parseExprSubscripts(refShorthandDefaultPos)
|
||||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
|
||||
while (this.type.postfix && !this.canInsertSemicolon()) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.operator = this.value
|
||||
node.prefix = false
|
||||
node.argument = expr
|
||||
this.checkLVal(expr)
|
||||
this.next()
|
||||
expr = this.finishNode(node, "UpdateExpression")
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
// Parse call, dot, and `[]`-subscript expressions.
|
||||
|
||||
pp.parseExprSubscripts = function(refShorthandDefaultPos) {
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
let expr = this.parseExprAtom(refShorthandDefaultPos)
|
||||
if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr
|
||||
return this.parseSubscripts(expr, startPos, startLoc)
|
||||
}
|
||||
|
||||
pp.parseSubscripts = function(base, startPos, startLoc, noCalls) {
|
||||
if (Array.isArray(startPos)){
|
||||
if (this.options.locations && noCalls === undefined) {
|
||||
// shift arguments to left by one
|
||||
noCalls = startLoc
|
||||
// flatten startPos
|
||||
startLoc = startPos[1]
|
||||
startPos = startPos[0]
|
||||
}
|
||||
}
|
||||
for (;;) {
|
||||
if (this.eat(tt.dot)) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.object = base
|
||||
node.property = this.parseIdent(true)
|
||||
node.computed = false
|
||||
base = this.finishNode(node, "MemberExpression")
|
||||
} else if (this.eat(tt.bracketL)) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.object = base
|
||||
node.property = this.parseExpression()
|
||||
node.computed = true
|
||||
this.expect(tt.bracketR)
|
||||
base = this.finishNode(node, "MemberExpression")
|
||||
} else if (!noCalls && this.eat(tt.parenL)) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.callee = base
|
||||
node.arguments = this.parseExprList(tt.parenR, false)
|
||||
base = this.finishNode(node, "CallExpression")
|
||||
} else if (this.type === tt.backQuote) {
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.tag = base
|
||||
node.quasi = this.parseTemplate()
|
||||
base = this.finishNode(node, "TaggedTemplateExpression")
|
||||
} else {
|
||||
return base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse an atomic expression — either a single token that is an
|
||||
// expression, an expression started by a keyword like `function` or
|
||||
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
||||
// or `{}`.
|
||||
|
||||
pp.parseExprAtom = function(refShorthandDefaultPos) {
|
||||
let node, canBeArrow = this.potentialArrowAt == this.start
|
||||
switch (this.type) {
|
||||
case tt._this:
|
||||
case tt._super:
|
||||
let type = this.type === tt._this ? "ThisExpression" : "Super"
|
||||
node = this.startNode()
|
||||
this.next()
|
||||
return this.finishNode(node, type)
|
||||
|
||||
case tt._yield:
|
||||
if (this.inGenerator) this.unexpected()
|
||||
|
||||
case tt.name:
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
let id = this.parseIdent(this.type !== tt.name)
|
||||
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow))
|
||||
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id])
|
||||
return id
|
||||
|
||||
case tt.regexp:
|
||||
let value = this.value
|
||||
node = this.parseLiteral(value.value)
|
||||
node.regex = {pattern: value.pattern, flags: value.flags}
|
||||
return node
|
||||
|
||||
case tt.num: case tt.string:
|
||||
return this.parseLiteral(this.value)
|
||||
|
||||
case tt._null: case tt._true: case tt._false:
|
||||
node = this.startNode()
|
||||
node.value = this.type === tt._null ? null : this.type === tt._true
|
||||
node.raw = this.type.keyword
|
||||
this.next()
|
||||
return this.finishNode(node, "Literal")
|
||||
|
||||
case tt.parenL:
|
||||
return this.parseParenAndDistinguishExpression(canBeArrow)
|
||||
|
||||
case tt.bracketL:
|
||||
node = this.startNode()
|
||||
this.next()
|
||||
// check whether this is array comprehension or regular array
|
||||
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
|
||||
return this.parseComprehension(node, false)
|
||||
}
|
||||
node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos)
|
||||
return this.finishNode(node, "ArrayExpression")
|
||||
|
||||
case tt.braceL:
|
||||
return this.parseObj(false, refShorthandDefaultPos)
|
||||
|
||||
case tt._function:
|
||||
node = this.startNode()
|
||||
this.next()
|
||||
return this.parseFunction(node, false)
|
||||
|
||||
case tt._class:
|
||||
return this.parseClass(this.startNode(), false)
|
||||
|
||||
case tt._new:
|
||||
return this.parseNew()
|
||||
|
||||
case tt.backQuote:
|
||||
return this.parseTemplate()
|
||||
|
||||
default:
|
||||
this.unexpected()
|
||||
}
|
||||
}
|
||||
|
||||
pp.parseLiteral = function(value) {
|
||||
let node = this.startNode()
|
||||
node.value = value
|
||||
node.raw = this.input.slice(this.start, this.end)
|
||||
this.next()
|
||||
return this.finishNode(node, "Literal")
|
||||
}
|
||||
|
||||
pp.parseParenExpression = function() {
|
||||
this.expect(tt.parenL)
|
||||
let val = this.parseExpression()
|
||||
this.expect(tt.parenR)
|
||||
return val
|
||||
}
|
||||
|
||||
pp.parseParenAndDistinguishExpression = function(canBeArrow) {
|
||||
let startPos = this.start, startLoc = this.startLoc, val
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
this.next()
|
||||
|
||||
if (this.options.ecmaVersion >= 7 && this.type === tt._for) {
|
||||
return this.parseComprehension(this.startNodeAt(startPos, startLoc), true)
|
||||
}
|
||||
|
||||
let innerStartPos = this.start, innerStartLoc = this.startLoc
|
||||
let exprList = [], first = true
|
||||
let refShorthandDefaultPos = {start: 0}, spreadStart, innerParenStart
|
||||
while (this.type !== tt.parenR) {
|
||||
first ? first = false : this.expect(tt.comma)
|
||||
if (this.type === tt.ellipsis) {
|
||||
spreadStart = this.start
|
||||
exprList.push(this.parseParenItem(this.parseRest()))
|
||||
break
|
||||
} else {
|
||||
if (this.type === tt.parenL && !innerParenStart) {
|
||||
innerParenStart = this.start
|
||||
}
|
||||
exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem))
|
||||
}
|
||||
}
|
||||
let innerEndPos = this.start, innerEndLoc = this.startLoc
|
||||
this.expect(tt.parenR)
|
||||
|
||||
if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) {
|
||||
if (innerParenStart) this.unexpected(innerParenStart)
|
||||
return this.parseParenArrowList(startPos, startLoc, exprList)
|
||||
}
|
||||
|
||||
if (!exprList.length) this.unexpected(this.lastTokStart)
|
||||
if (spreadStart) this.unexpected(spreadStart)
|
||||
if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start)
|
||||
|
||||
if (exprList.length > 1) {
|
||||
val = this.startNodeAt(innerStartPos, innerStartLoc)
|
||||
val.expressions = exprList
|
||||
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc)
|
||||
} else {
|
||||
val = exprList[0]
|
||||
}
|
||||
} else {
|
||||
val = this.parseParenExpression()
|
||||
}
|
||||
|
||||
if (this.options.preserveParens) {
|
||||
let par = this.startNodeAt(startPos, startLoc)
|
||||
par.expression = val
|
||||
return this.finishNode(par, "ParenthesizedExpression")
|
||||
} else {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
pp.parseParenItem = function(item) {
|
||||
return item
|
||||
}
|
||||
|
||||
pp.parseParenArrowList = function(startPos, startLoc, exprList) {
|
||||
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
|
||||
}
|
||||
|
||||
// New's precedence is slightly tricky. It must allow its argument
|
||||
// to be a `[]` or dot subscript expression, but not a call — at
|
||||
// least, not without wrapping it in parentheses. Thus, it uses the
|
||||
|
||||
const empty = []
|
||||
|
||||
pp.parseNew = function() {
|
||||
let node = this.startNode()
|
||||
let meta = this.parseIdent(true)
|
||||
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
|
||||
node.meta = meta
|
||||
node.property = this.parseIdent(true)
|
||||
if (node.property.name !== "target")
|
||||
this.raise(node.property.start, "The only valid meta property for new is new.target")
|
||||
return this.finishNode(node, "MetaProperty")
|
||||
}
|
||||
let startPos = this.start, startLoc = this.startLoc
|
||||
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true)
|
||||
if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false)
|
||||
else node.arguments = empty
|
||||
return this.finishNode(node, "NewExpression")
|
||||
}
|
||||
|
||||
// Parse template expression.
|
||||
|
||||
pp.parseTemplateElement = function() {
|
||||
let elem = this.startNode()
|
||||
elem.value = {
|
||||
raw: this.input.slice(this.start, this.end),
|
||||
cooked: this.value
|
||||
}
|
||||
this.next()
|
||||
elem.tail = this.type === tt.backQuote
|
||||
return this.finishNode(elem, "TemplateElement")
|
||||
}
|
||||
|
||||
pp.parseTemplate = function() {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.expressions = []
|
||||
let curElt = this.parseTemplateElement()
|
||||
node.quasis = [curElt]
|
||||
while (!curElt.tail) {
|
||||
this.expect(tt.dollarBraceL)
|
||||
node.expressions.push(this.parseExpression())
|
||||
this.expect(tt.braceR)
|
||||
node.quasis.push(curElt = this.parseTemplateElement())
|
||||
}
|
||||
this.next()
|
||||
return this.finishNode(node, "TemplateLiteral")
|
||||
}
|
||||
|
||||
// Parse an object literal or binding pattern.
|
||||
|
||||
pp.parseObj = function(isPattern, refShorthandDefaultPos) {
|
||||
let node = this.startNode(), first = true, propHash = {}
|
||||
node.properties = []
|
||||
this.next()
|
||||
while (!this.eat(tt.braceR)) {
|
||||
if (!first) {
|
||||
this.expect(tt.comma)
|
||||
if (this.afterTrailingComma(tt.braceR)) break
|
||||
} else first = false
|
||||
|
||||
let prop = this.startNode(), isGenerator, startPos, startLoc
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
prop.method = false
|
||||
prop.shorthand = false
|
||||
if (isPattern || refShorthandDefaultPos) {
|
||||
startPos = this.start
|
||||
startLoc = this.startLoc
|
||||
}
|
||||
if (!isPattern)
|
||||
isGenerator = this.eat(tt.star)
|
||||
}
|
||||
this.parsePropertyName(prop)
|
||||
this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos)
|
||||
this.checkPropClash(prop, propHash)
|
||||
node.properties.push(this.finishNode(prop, "Property"))
|
||||
}
|
||||
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
||||
}
|
||||
|
||||
pp.parsePropertyValue = function(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) {
|
||||
if (this.eat(tt.colon)) {
|
||||
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos)
|
||||
prop.kind = "init"
|
||||
} else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) {
|
||||
if (isPattern) this.unexpected()
|
||||
prop.kind = "init"
|
||||
prop.method = true
|
||||
prop.value = this.parseMethod(isGenerator)
|
||||
} else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
||||
(prop.key.name === "get" || prop.key.name === "set") &&
|
||||
(this.type != tt.comma && this.type != tt.braceR)) {
|
||||
if (isGenerator || isPattern) this.unexpected()
|
||||
prop.kind = prop.key.name
|
||||
this.parsePropertyName(prop)
|
||||
prop.value = this.parseMethod(false)
|
||||
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
||||
prop.kind = "init"
|
||||
if (isPattern) {
|
||||
if (this.isKeyword(prop.key.name) ||
|
||||
(this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name))) ||
|
||||
(!this.options.allowReserved && this.isReservedWord(prop.key.name)))
|
||||
this.raise(prop.key.start, "Binding " + prop.key.name)
|
||||
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
|
||||
} else if (this.type === tt.eq && refShorthandDefaultPos) {
|
||||
if (!refShorthandDefaultPos.start)
|
||||
refShorthandDefaultPos.start = this.start
|
||||
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key)
|
||||
} else {
|
||||
prop.value = prop.key
|
||||
}
|
||||
prop.shorthand = true
|
||||
} else this.unexpected()
|
||||
}
|
||||
|
||||
pp.parsePropertyName = function(prop) {
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
if (this.eat(tt.bracketL)) {
|
||||
prop.computed = true
|
||||
prop.key = this.parseMaybeAssign()
|
||||
this.expect(tt.bracketR)
|
||||
return prop.key
|
||||
} else {
|
||||
prop.computed = false
|
||||
}
|
||||
}
|
||||
return prop.key = (this.type === tt.num || this.type === tt.string) ? this.parseExprAtom() : this.parseIdent(true)
|
||||
}
|
||||
|
||||
// Initialize empty function node.
|
||||
|
||||
pp.initFunction = function(node) {
|
||||
node.id = null
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
node.generator = false
|
||||
node.expression = false
|
||||
}
|
||||
}
|
||||
|
||||
// Parse object or class method.
|
||||
|
||||
pp.parseMethod = function(isGenerator) {
|
||||
let node = this.startNode()
|
||||
this.initFunction(node)
|
||||
this.expect(tt.parenL)
|
||||
node.params = this.parseBindingList(tt.parenR, false, false)
|
||||
let allowExpressionBody
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
node.generator = isGenerator
|
||||
allowExpressionBody = true
|
||||
} else {
|
||||
allowExpressionBody = false
|
||||
}
|
||||
this.parseFunctionBody(node, allowExpressionBody)
|
||||
return this.finishNode(node, "FunctionExpression")
|
||||
}
|
||||
|
||||
// Parse arrow function expression with given parameters.
|
||||
|
||||
pp.parseArrowExpression = function(node, params) {
|
||||
this.initFunction(node)
|
||||
node.params = this.toAssignableList(params, true)
|
||||
this.parseFunctionBody(node, true)
|
||||
return this.finishNode(node, "ArrowFunctionExpression")
|
||||
}
|
||||
|
||||
// Parse function body and check parameters.
|
||||
|
||||
pp.parseFunctionBody = function(node, allowExpression) {
|
||||
let isExpression = allowExpression && this.type !== tt.braceL
|
||||
|
||||
if (isExpression) {
|
||||
node.body = this.parseMaybeAssign()
|
||||
node.expression = true
|
||||
} else {
|
||||
// Start a new scope with regard to labels and the `inFunction`
|
||||
// flag (restore them to their old value afterwards).
|
||||
let oldInFunc = this.inFunction, oldInGen = this.inGenerator, oldLabels = this.labels
|
||||
this.inFunction = true; this.inGenerator = node.generator; this.labels = []
|
||||
node.body = this.parseBlock(true)
|
||||
node.expression = false
|
||||
this.inFunction = oldInFunc; this.inGenerator = oldInGen; this.labels = oldLabels
|
||||
}
|
||||
|
||||
// If this is a strict mode function, verify that argument names
|
||||
// are not repeated, and it does not try to bind the words `eval`
|
||||
// or `arguments`.
|
||||
if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) {
|
||||
let nameHash = {}, oldStrict = this.strict
|
||||
this.strict = true
|
||||
if (node.id)
|
||||
this.checkLVal(node.id, true)
|
||||
for (let i = 0; i < node.params.length; i++)
|
||||
this.checkLVal(node.params[i], true, nameHash)
|
||||
this.strict = oldStrict
|
||||
}
|
||||
}
|
||||
|
||||
// Parses a comma-separated list of expressions, and returns them as
|
||||
// an array. `close` is the token type that ends the list, and
|
||||
// `allowEmpty` can be turned on to allow subsequent commas with
|
||||
// nothing in between them to be parsed as `null` (which is needed
|
||||
// for array literals).
|
||||
|
||||
pp.parseExprList = function(close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) {
|
||||
let elts = [], first = true
|
||||
while (!this.eat(close)) {
|
||||
if (!first) {
|
||||
this.expect(tt.comma)
|
||||
if (allowTrailingComma && this.afterTrailingComma(close)) break
|
||||
} else first = false
|
||||
|
||||
if (allowEmpty && this.type === tt.comma) {
|
||||
elts.push(null)
|
||||
} else {
|
||||
if (this.type === tt.ellipsis)
|
||||
elts.push(this.parseSpread(refShorthandDefaultPos))
|
||||
else
|
||||
elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos))
|
||||
}
|
||||
}
|
||||
return elts
|
||||
}
|
||||
|
||||
// Parse the next token as an identifier. If `liberal` is true (used
|
||||
// when parsing properties), it will also convert keywords into
|
||||
// identifiers.
|
||||
|
||||
pp.parseIdent = function(liberal) {
|
||||
let node = this.startNode()
|
||||
if (liberal && this.options.allowReserved == "never") liberal = false
|
||||
if (this.type === tt.name) {
|
||||
if (!liberal &&
|
||||
((!this.options.allowReserved && this.isReservedWord(this.value)) ||
|
||||
(this.strict && reservedWords.strict(this.value)) &&
|
||||
(this.options.ecmaVersion >= 6 ||
|
||||
this.input.slice(this.start, this.end).indexOf("\\") == -1)))
|
||||
this.raise(this.start, "The keyword '" + this.value + "' is reserved")
|
||||
node.name = this.value
|
||||
} else if (liberal && this.type.keyword) {
|
||||
node.name = this.type.keyword
|
||||
} else {
|
||||
this.unexpected()
|
||||
}
|
||||
this.next()
|
||||
return this.finishNode(node, "Identifier")
|
||||
}
|
||||
|
||||
// Parses yield expression inside generator.
|
||||
|
||||
pp.parseYield = function() {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) {
|
||||
node.delegate = false
|
||||
node.argument = null
|
||||
} else {
|
||||
node.delegate = this.eat(tt.star)
|
||||
node.argument = this.parseMaybeAssign()
|
||||
}
|
||||
return this.finishNode(node, "YieldExpression")
|
||||
}
|
||||
|
||||
// Parses array and generator comprehensions.
|
||||
|
||||
pp.parseComprehension = function(node, isGenerator) {
|
||||
node.blocks = []
|
||||
while (this.type === tt._for) {
|
||||
let block = this.startNode()
|
||||
this.next()
|
||||
this.expect(tt.parenL)
|
||||
block.left = this.parseBindingAtom()
|
||||
this.checkLVal(block.left, true)
|
||||
this.expectContextual("of")
|
||||
block.right = this.parseExpression()
|
||||
this.expect(tt.parenR)
|
||||
node.blocks.push(this.finishNode(block, "ComprehensionBlock"))
|
||||
}
|
||||
node.filter = this.eat(tt._if) ? this.parseParenExpression() : null
|
||||
node.body = this.parseExpression()
|
||||
this.expect(isGenerator ? tt.parenR : tt.bracketR)
|
||||
node.generator = isGenerator
|
||||
return this.finishNode(node, "ComprehensionExpression")
|
||||
}
|
129
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/identifier.js
generated
vendored
Normal file
129
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/identifier.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
// This is a trick taken from Esprima. It turns out that, on
|
||||
// non-Chrome browsers, to check whether a string is in a set, a
|
||||
// predicate containing a big ugly `switch` statement is faster than
|
||||
// a regular expression, and on Chrome the two are about on par.
|
||||
// This function uses `eval` (non-lexical) to produce such a
|
||||
// predicate from a space-separated string of words.
|
||||
//
|
||||
// It starts by sorting the words by length.
|
||||
|
||||
function makePredicate(words) {
|
||||
words = words.split(" ")
|
||||
let f = "", cats = []
|
||||
out: for (let i = 0; i < words.length; ++i) {
|
||||
for (let j = 0; j < cats.length; ++j)
|
||||
if (cats[j][0].length == words[i].length) {
|
||||
cats[j].push(words[i])
|
||||
continue out
|
||||
}
|
||||
cats.push([words[i]])
|
||||
}
|
||||
function compareTo(arr) {
|
||||
if (arr.length == 1) return f += "return str === " + JSON.stringify(arr[0]) + ";"
|
||||
f += "switch(str){"
|
||||
for (let i = 0; i < arr.length; ++i) f += "case " + JSON.stringify(arr[i]) + ":"
|
||||
f += "return true}return false;"
|
||||
}
|
||||
|
||||
// When there are more than three length categories, an outer
|
||||
// switch first dispatches on the lengths, to save on comparisons.
|
||||
|
||||
if (cats.length > 3) {
|
||||
cats.sort((a, b) => b.length - a.length)
|
||||
f += "switch(str.length){"
|
||||
for (let i = 0; i < cats.length; ++i) {
|
||||
let cat = cats[i]
|
||||
f += "case " + cat[0].length + ":"
|
||||
compareTo(cat)
|
||||
}
|
||||
f += "}"
|
||||
|
||||
// Otherwise, simply generate a flat `switch` statement.
|
||||
|
||||
} else {
|
||||
compareTo(words)
|
||||
}
|
||||
return new Function("str", f)
|
||||
}
|
||||
|
||||
// Reserved word lists for various dialects of the language
|
||||
|
||||
export const reservedWords = {
|
||||
3: makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),
|
||||
5: makePredicate("class enum extends super const export import"),
|
||||
6: makePredicate("enum await"),
|
||||
strict: makePredicate("implements interface let package private protected public static yield"),
|
||||
strictBind: makePredicate("eval arguments")
|
||||
}
|
||||
|
||||
// And the keywords
|
||||
|
||||
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"
|
||||
|
||||
export const keywords = {
|
||||
5: makePredicate(ecma5AndLessKeywords),
|
||||
6: makePredicate(ecma5AndLessKeywords + " let const class extends export import yield super")
|
||||
}
|
||||
|
||||
// ## Character categories
|
||||
|
||||
// Big ugly regular expressions that match characters in the
|
||||
// whitespace, identifier, and identifier-start categories. These
|
||||
// are only applied when a character is found to actually have a
|
||||
// code point above 128.
|
||||
// Generated by `tools/generate-identifier-regex.js`.
|
||||
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b2\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua7ad\ua7b0\ua7b1\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab5f\uab64\uab65\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"
|
||||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d01-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2d\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"
|
||||
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]")
|
||||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]")
|
||||
|
||||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null
|
||||
|
||||
// These are a run-length and offset encoded representation of the
|
||||
// >0xffff code points that are a valid part of identifiers. The
|
||||
// offset starts at 0x10000, and each pair of numbers represents an
|
||||
// offset to the next range, and then a size of the range. They were
|
||||
// generated by tools/generate-identifier-regex.js
|
||||
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541]
|
||||
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]
|
||||
|
||||
// This has a complexity linear to the value of the code. The
|
||||
// assumption is that looking up astral identifier characters is
|
||||
// rare.
|
||||
function isInAstralSet(code, set) {
|
||||
let pos = 0x10000
|
||||
for (let i = 0; i < set.length; i += 2) {
|
||||
pos += set[i]
|
||||
if (pos > code) return false
|
||||
pos += set[i + 1]
|
||||
if (pos >= code) return true
|
||||
}
|
||||
}
|
||||
|
||||
// Test whether a given character code starts an identifier.
|
||||
|
||||
export function isIdentifierStart(code, astral) {
|
||||
if (code < 65) return code === 36
|
||||
if (code < 91) return true
|
||||
if (code < 97) return code === 95
|
||||
if (code < 123) return true
|
||||
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))
|
||||
if (astral === false) return false
|
||||
return isInAstralSet(code, astralIdentifierStartCodes)
|
||||
}
|
||||
|
||||
// Test whether a given character is part of an identifier.
|
||||
|
||||
export function isIdentifierChar(code, astral) {
|
||||
if (code < 48) return code === 36
|
||||
if (code < 58) return true
|
||||
if (code < 65) return false
|
||||
if (code < 91) return true
|
||||
if (code < 97) return code === 95
|
||||
if (code < 123) return true
|
||||
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))
|
||||
if (astral === false) return false
|
||||
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
|
||||
}
|
75
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/index.js
generated
vendored
Normal file
75
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
||||
//
|
||||
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
||||
// various contributors and released under an MIT license.
|
||||
//
|
||||
// Git repositories for Acorn are available at
|
||||
//
|
||||
// http://marijnhaverbeke.nl/git/acorn
|
||||
// https://github.com/marijnh/acorn.git
|
||||
//
|
||||
// Please use the [github bug tracker][ghbt] to report issues.
|
||||
//
|
||||
// [ghbt]: https://github.com/marijnh/acorn/issues
|
||||
//
|
||||
// This file defines the main parser interface. The library also comes
|
||||
// with a [error-tolerant parser][dammit] and an
|
||||
// [abstract syntax tree walker][walk], defined in other files.
|
||||
//
|
||||
// [dammit]: acorn_loose.js
|
||||
// [walk]: util/walk.js
|
||||
|
||||
import {Parser} from "./state"
|
||||
import {getOptions} from "./options"
|
||||
import "./parseutil"
|
||||
import "./statement"
|
||||
import "./lval"
|
||||
import "./expression"
|
||||
|
||||
export {Parser, plugins} from "./state"
|
||||
export {defaultOptions} from "./options"
|
||||
export {SourceLocation} from "./location"
|
||||
export {getLineInfo} from "./location"
|
||||
export {Node} from "./node"
|
||||
export {TokenType, types as tokTypes} from "./tokentype"
|
||||
export {TokContext, types as tokContexts} from "./tokencontext"
|
||||
export {isIdentifierChar, isIdentifierStart} from "./identifier"
|
||||
export {Token} from "./tokenize"
|
||||
export {isNewLine, lineBreak, lineBreakG} from "./whitespace"
|
||||
|
||||
export const version = "1.2.2"
|
||||
|
||||
// The main exported interface (under `self.acorn` when in the
|
||||
// browser) is a `parse` function that takes a code string and
|
||||
// returns an abstract syntax tree as specified by [Mozilla parser
|
||||
// API][api].
|
||||
//
|
||||
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
|
||||
|
||||
export function parse(input, options) {
|
||||
let p = parser(options, input)
|
||||
let startPos = p.pos, startLoc = p.options.locations && p.curPosition()
|
||||
p.nextToken()
|
||||
return p.parseTopLevel(p.options.program || p.startNodeAt(startPos, startLoc))
|
||||
}
|
||||
|
||||
// This function tries to parse a single expression at a given
|
||||
// offset in a string. Useful for parsing mixed-language formats
|
||||
// that embed JavaScript expressions.
|
||||
|
||||
export function parseExpressionAt(input, pos, options) {
|
||||
let p = parser(options, input, pos)
|
||||
p.nextToken()
|
||||
return p.parseExpression()
|
||||
}
|
||||
|
||||
// Acorn is organized as a tokenizer and a recursive-descent parser.
|
||||
// The `tokenize` export provides an interface to the tokenizer.
|
||||
|
||||
export function tokenizer(input, options) {
|
||||
return parser(options, input)
|
||||
}
|
||||
|
||||
function parser(options, input) {
|
||||
return new Parser(getOptions(options), String(input))
|
||||
}
|
68
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/location.js
generated
vendored
Executable file
68
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/location.js
generated
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
import {Parser} from "./state"
|
||||
import {lineBreakG} from "./whitespace"
|
||||
import {deprecate} from "util"
|
||||
|
||||
// These are used when `options.locations` is on, for the
|
||||
// `startLoc` and `endLoc` properties.
|
||||
|
||||
export class Position {
|
||||
constructor(line, col) {
|
||||
this.line = line
|
||||
this.column = col
|
||||
}
|
||||
|
||||
offset(n) {
|
||||
return new Position(this.line, this.column + n)
|
||||
}
|
||||
}
|
||||
|
||||
export class SourceLocation {
|
||||
constructor(p, start, end) {
|
||||
this.start = start
|
||||
this.end = end
|
||||
if (p.sourceFile !== null) this.source = p.sourceFile
|
||||
}
|
||||
}
|
||||
|
||||
// The `getLineInfo` function is mostly useful when the
|
||||
// `locations` option is off (for performance reasons) and you
|
||||
// want to find the line/column position for a given character
|
||||
// offset. `input` should be the code string that the offset refers
|
||||
// into.
|
||||
|
||||
export function getLineInfo(input, offset) {
|
||||
for (let line = 1, cur = 0;;) {
|
||||
lineBreakG.lastIndex = cur
|
||||
let match = lineBreakG.exec(input)
|
||||
if (match && match.index < offset) {
|
||||
++line
|
||||
cur = match.index + match[0].length
|
||||
} else {
|
||||
return new Position(line, offset - cur)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
// This function is used to raise exceptions on parse errors. It
|
||||
// takes an offset integer (into the current `input`) to indicate
|
||||
// the location of the error, attaches the position to the end
|
||||
// of the error message, and then raises a `SyntaxError` with that
|
||||
// message.
|
||||
|
||||
pp.raise = function(pos, message) {
|
||||
let loc = getLineInfo(this.input, pos)
|
||||
message += " (" + loc.line + ":" + loc.column + ")"
|
||||
let err = new SyntaxError(message)
|
||||
err.pos = pos; err.loc = loc; err.raisedAt = this.pos
|
||||
throw err
|
||||
}
|
||||
|
||||
pp.curPosition = function() {
|
||||
return new Position(this.curLine, this.pos - this.lineStart)
|
||||
}
|
||||
|
||||
pp.markPosition = function() {
|
||||
return this.options.locations ? [this.start, this.startLoc] : this.start
|
||||
}
|
0
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/acorn_loose.js
generated
vendored
Normal file
0
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/acorn_loose.js
generated
vendored
Normal file
511
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/expression.js
generated
vendored
Normal file
511
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/expression.js
generated
vendored
Normal file
@@ -0,0 +1,511 @@
|
||||
import {LooseParser} from "./state"
|
||||
import {isDummy} from "./parseutil"
|
||||
import {tokTypes as tt} from ".."
|
||||
|
||||
const lp = LooseParser.prototype
|
||||
|
||||
lp.checkLVal = function(expr, binding) {
|
||||
if (!expr) return expr
|
||||
switch (expr.type) {
|
||||
case "Identifier":
|
||||
return expr
|
||||
|
||||
case "MemberExpression":
|
||||
return binding ? this.dummyIdent() : expr
|
||||
|
||||
case "ParenthesizedExpression":
|
||||
expr.expression = this.checkLVal(expr.expression, binding)
|
||||
return expr
|
||||
|
||||
// FIXME recursively check contents
|
||||
case "ObjectPattern":
|
||||
case "ArrayPattern":
|
||||
case "RestElement":
|
||||
case "AssignmentPattern":
|
||||
if (this.options.ecmaVersion >= 6) return expr
|
||||
|
||||
default:
|
||||
return this.dummyIdent()
|
||||
}
|
||||
}
|
||||
|
||||
lp.parseExpression = function(noIn) {
|
||||
let start = this.storeCurrentPos()
|
||||
let expr = this.parseMaybeAssign(noIn)
|
||||
if (this.tok.type === tt.comma) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.expressions = [expr]
|
||||
while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn))
|
||||
return this.finishNode(node, "SequenceExpression")
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
lp.parseParenExpression = function() {
|
||||
this.pushCx()
|
||||
this.expect(tt.parenL)
|
||||
let val = this.parseExpression()
|
||||
this.popCx()
|
||||
this.expect(tt.parenR)
|
||||
return val
|
||||
}
|
||||
|
||||
lp.parseMaybeAssign = function(noIn) {
|
||||
let start = this.storeCurrentPos()
|
||||
let left = this.parseMaybeConditional(noIn)
|
||||
if (this.tok.type.isAssign) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.operator = this.tok.value
|
||||
node.left = this.tok.type === tt.eq ? this.toAssignable(left) : this.checkLVal(left)
|
||||
this.next()
|
||||
node.right = this.parseMaybeAssign(noIn)
|
||||
return this.finishNode(node, "AssignmentExpression")
|
||||
}
|
||||
return left
|
||||
}
|
||||
|
||||
lp.parseMaybeConditional = function(noIn) {
|
||||
let start = this.storeCurrentPos()
|
||||
let expr = this.parseExprOps(noIn)
|
||||
if (this.eat(tt.question)) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.test = expr
|
||||
node.consequent = this.parseMaybeAssign()
|
||||
node.alternate = this.expect(tt.colon) ? this.parseMaybeAssign(noIn) : this.dummyIdent()
|
||||
return this.finishNode(node, "ConditionalExpression")
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
lp.parseExprOps = function(noIn) {
|
||||
let start = this.storeCurrentPos()
|
||||
let indent = this.curIndent, line = this.curLineStart
|
||||
return this.parseExprOp(this.parseMaybeUnary(noIn), start, -1, noIn, indent, line)
|
||||
}
|
||||
|
||||
lp.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
|
||||
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) return left
|
||||
let prec = this.tok.type.binop
|
||||
if (prec != null && (!noIn || this.tok.type !== tt._in)) {
|
||||
if (prec > minPrec) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.left = left
|
||||
node.operator = this.tok.value
|
||||
this.next()
|
||||
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) {
|
||||
node.right = this.dummyIdent()
|
||||
} else {
|
||||
let rightStart = this.storeCurrentPos()
|
||||
node.right = this.parseExprOp(this.parseMaybeUnary(noIn), rightStart, prec, noIn, indent, line)
|
||||
}
|
||||
this.finishNode(node, /&&|\|\|/.test(node.operator) ? "LogicalExpression" : "BinaryExpression")
|
||||
return this.parseExprOp(node, start, minPrec, noIn, indent, line)
|
||||
}
|
||||
}
|
||||
return left
|
||||
}
|
||||
|
||||
lp.parseMaybeUnary = function(noIn) {
|
||||
if (this.tok.type.prefix) {
|
||||
let node = this.startNode(), update = this.tok.type === tt.incDec
|
||||
node.operator = this.tok.value
|
||||
node.prefix = true
|
||||
this.next()
|
||||
node.argument = this.parseMaybeUnary(noIn)
|
||||
if (update) node.argument = this.checkLVal(node.argument)
|
||||
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression")
|
||||
} else if (this.tok.type === tt.ellipsis) {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.argument = this.parseMaybeUnary(noIn)
|
||||
return this.finishNode(node, "SpreadElement")
|
||||
}
|
||||
let start = this.storeCurrentPos()
|
||||
let expr = this.parseExprSubscripts()
|
||||
while (this.tok.type.postfix && !this.canInsertSemicolon()) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.operator = this.tok.value
|
||||
node.prefix = false
|
||||
node.argument = this.checkLVal(expr)
|
||||
this.next()
|
||||
expr = this.finishNode(node, "UpdateExpression")
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
lp.parseExprSubscripts = function() {
|
||||
let start = this.storeCurrentPos()
|
||||
return this.parseSubscripts(this.parseExprAtom(), start, false, this.curIndent, this.curLineStart)
|
||||
}
|
||||
|
||||
lp.parseSubscripts = function(base, start, noCalls, startIndent, line) {
|
||||
for (;;) {
|
||||
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine()) {
|
||||
if (this.tok.type == tt.dot && this.curIndent == startIndent)
|
||||
--startIndent
|
||||
else
|
||||
return base
|
||||
}
|
||||
|
||||
if (this.eat(tt.dot)) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.object = base
|
||||
if (this.curLineStart != line && this.curIndent <= startIndent && this.tokenStartsLine())
|
||||
node.property = this.dummyIdent()
|
||||
else
|
||||
node.property = this.parsePropertyAccessor() || this.dummyIdent()
|
||||
node.computed = false
|
||||
base = this.finishNode(node, "MemberExpression")
|
||||
} else if (this.tok.type == tt.bracketL) {
|
||||
this.pushCx()
|
||||
this.next()
|
||||
let node = this.startNodeAt(start)
|
||||
node.object = base
|
||||
node.property = this.parseExpression()
|
||||
node.computed = true
|
||||
this.popCx()
|
||||
this.expect(tt.bracketR)
|
||||
base = this.finishNode(node, "MemberExpression")
|
||||
} else if (!noCalls && this.tok.type == tt.parenL) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.callee = base
|
||||
node.arguments = this.parseExprList(tt.parenR)
|
||||
base = this.finishNode(node, "CallExpression")
|
||||
} else if (this.tok.type == tt.backQuote) {
|
||||
let node = this.startNodeAt(start)
|
||||
node.tag = base
|
||||
node.quasi = this.parseTemplate()
|
||||
base = this.finishNode(node, "TaggedTemplateExpression")
|
||||
} else {
|
||||
return base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lp.parseExprAtom = function() {
|
||||
let node
|
||||
switch (this.tok.type) {
|
||||
case tt._this:
|
||||
case tt._super:
|
||||
let type = this.tok.type === tt._this ? "ThisExpression" : "Super"
|
||||
node = this.startNode()
|
||||
this.next()
|
||||
return this.finishNode(node, type)
|
||||
|
||||
case tt.name:
|
||||
let start = this.storeCurrentPos()
|
||||
let id = this.parseIdent()
|
||||
return this.eat(tt.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id
|
||||
|
||||
case tt.regexp:
|
||||
node = this.startNode()
|
||||
let val = this.tok.value
|
||||
node.regex = {pattern: val.pattern, flags: val.flags}
|
||||
node.value = val.value
|
||||
node.raw = this.input.slice(this.tok.start, this.tok.end)
|
||||
this.next()
|
||||
return this.finishNode(node, "Literal")
|
||||
|
||||
case tt.num: case tt.string:
|
||||
node = this.startNode()
|
||||
node.value = this.tok.value
|
||||
node.raw = this.input.slice(this.tok.start, this.tok.end)
|
||||
this.next()
|
||||
return this.finishNode(node, "Literal")
|
||||
|
||||
case tt._null: case tt._true: case tt._false:
|
||||
node = this.startNode()
|
||||
node.value = this.tok.type === tt._null ? null : this.tok.type === tt._true
|
||||
node.raw = this.tok.type.keyword
|
||||
this.next()
|
||||
return this.finishNode(node, "Literal")
|
||||
|
||||
case tt.parenL:
|
||||
let parenStart = this.storeCurrentPos()
|
||||
this.next()
|
||||
let inner = this.parseExpression()
|
||||
this.expect(tt.parenR)
|
||||
if (this.eat(tt.arrow)) {
|
||||
return this.parseArrowExpression(this.startNodeAt(parenStart), inner.expressions || (isDummy(inner) ? [] : [inner]))
|
||||
}
|
||||
if (this.options.preserveParens) {
|
||||
let par = this.startNodeAt(parenStart)
|
||||
par.expression = inner
|
||||
inner = this.finishNode(par, "ParenthesizedExpression")
|
||||
}
|
||||
return inner
|
||||
|
||||
case tt.bracketL:
|
||||
node = this.startNode()
|
||||
node.elements = this.parseExprList(tt.bracketR, true)
|
||||
return this.finishNode(node, "ArrayExpression")
|
||||
|
||||
case tt.braceL:
|
||||
return this.parseObj()
|
||||
|
||||
case tt._class:
|
||||
return this.parseClass()
|
||||
|
||||
case tt._function:
|
||||
node = this.startNode()
|
||||
this.next()
|
||||
return this.parseFunction(node, false)
|
||||
|
||||
case tt._new:
|
||||
return this.parseNew()
|
||||
|
||||
case tt._yield:
|
||||
node = this.startNode()
|
||||
this.next()
|
||||
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type != tt.star && !this.tok.type.startsExpr)) {
|
||||
node.delegate = false
|
||||
node.argument = null
|
||||
} else {
|
||||
node.delegate = this.eat(tt.star)
|
||||
node.argument = this.parseMaybeAssign()
|
||||
}
|
||||
return this.finishNode(node, "YieldExpression")
|
||||
|
||||
case tt.backQuote:
|
||||
return this.parseTemplate()
|
||||
|
||||
default:
|
||||
return this.dummyIdent()
|
||||
}
|
||||
}
|
||||
|
||||
lp.parseNew = function() {
|
||||
let node = this.startNode(), startIndent = this.curIndent, line = this.curLineStart
|
||||
let meta = this.parseIdent(true)
|
||||
if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) {
|
||||
node.meta = meta
|
||||
node.property = this.parseIdent(true)
|
||||
return this.finishNode(node, "MetaProperty")
|
||||
}
|
||||
let start = this.storeCurrentPos()
|
||||
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line)
|
||||
if (this.tok.type == tt.parenL) {
|
||||
node.arguments = this.parseExprList(tt.parenR)
|
||||
} else {
|
||||
node.arguments = []
|
||||
}
|
||||
return this.finishNode(node, "NewExpression")
|
||||
}
|
||||
|
||||
lp.parseTemplateElement = function() {
|
||||
let elem = this.startNode()
|
||||
elem.value = {
|
||||
raw: this.input.slice(this.tok.start, this.tok.end),
|
||||
cooked: this.tok.value
|
||||
}
|
||||
this.next()
|
||||
elem.tail = this.tok.type === tt.backQuote
|
||||
return this.finishNode(elem, "TemplateElement")
|
||||
}
|
||||
|
||||
lp.parseTemplate = function() {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.expressions = []
|
||||
let curElt = this.parseTemplateElement()
|
||||
node.quasis = [curElt]
|
||||
while (!curElt.tail) {
|
||||
this.next()
|
||||
node.expressions.push(this.parseExpression())
|
||||
if (this.expect(tt.braceR)) {
|
||||
curElt = this.parseTemplateElement()
|
||||
} else {
|
||||
curElt = this.startNode()
|
||||
curElt.value = {cooked: '', raw: ''}
|
||||
curElt.tail = true
|
||||
}
|
||||
node.quasis.push(curElt)
|
||||
}
|
||||
this.expect(tt.backQuote)
|
||||
return this.finishNode(node, "TemplateLiteral")
|
||||
}
|
||||
|
||||
lp.parseObj = function() {
|
||||
let node = this.startNode()
|
||||
node.properties = []
|
||||
this.pushCx()
|
||||
let indent = this.curIndent + 1, line = this.curLineStart
|
||||
this.eat(tt.braceL)
|
||||
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
|
||||
while (!this.closes(tt.braceR, indent, line)) {
|
||||
let prop = this.startNode(), isGenerator, start
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
start = this.storeCurrentPos()
|
||||
prop.method = false
|
||||
prop.shorthand = false
|
||||
isGenerator = this.eat(tt.star)
|
||||
}
|
||||
this.parsePropertyName(prop)
|
||||
if (isDummy(prop.key)) { if (isDummy(this.parseMaybeAssign())) this.next(); this.eat(tt.comma); continue }
|
||||
if (this.eat(tt.colon)) {
|
||||
prop.kind = "init"
|
||||
prop.value = this.parseMaybeAssign()
|
||||
} else if (this.options.ecmaVersion >= 6 && (this.tok.type === tt.parenL || this.tok.type === tt.braceL)) {
|
||||
prop.kind = "init"
|
||||
prop.method = true
|
||||
prop.value = this.parseMethod(isGenerator)
|
||||
} else if (this.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
|
||||
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
|
||||
(this.tok.type != tt.comma && this.tok.type != tt.braceR)) {
|
||||
prop.kind = prop.key.name
|
||||
this.parsePropertyName(prop)
|
||||
prop.value = this.parseMethod(false)
|
||||
} else {
|
||||
prop.kind = "init"
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
if (this.eat(tt.eq)) {
|
||||
let assign = this.startNodeAt(start)
|
||||
assign.operator = "="
|
||||
assign.left = prop.key
|
||||
assign.right = this.parseMaybeAssign()
|
||||
prop.value = this.finishNode(assign, "AssignmentExpression")
|
||||
} else {
|
||||
prop.value = prop.key
|
||||
}
|
||||
} else {
|
||||
prop.value = this.dummyIdent()
|
||||
}
|
||||
prop.shorthand = true
|
||||
}
|
||||
node.properties.push(this.finishNode(prop, "Property"))
|
||||
this.eat(tt.comma)
|
||||
}
|
||||
this.popCx()
|
||||
if (!this.eat(tt.braceR)) {
|
||||
// If there is no closing brace, make the node span to the start
|
||||
// of the next token (this is useful for Tern)
|
||||
this.last.end = this.tok.start
|
||||
if (this.options.locations) this.last.loc.end = this.tok.loc.start
|
||||
}
|
||||
return this.finishNode(node, "ObjectExpression")
|
||||
}
|
||||
|
||||
lp.parsePropertyName = function(prop) {
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
if (this.eat(tt.bracketL)) {
|
||||
prop.computed = true
|
||||
prop.key = this.parseExpression()
|
||||
this.expect(tt.bracketR)
|
||||
return
|
||||
} else {
|
||||
prop.computed = false
|
||||
}
|
||||
}
|
||||
let key = (this.tok.type === tt.num || this.tok.type === tt.string) ? this.parseExprAtom() : this.parseIdent()
|
||||
prop.key = key || this.dummyIdent()
|
||||
}
|
||||
|
||||
lp.parsePropertyAccessor = function() {
|
||||
if (this.tok.type === tt.name || this.tok.type.keyword) return this.parseIdent()
|
||||
}
|
||||
|
||||
lp.parseIdent = function() {
|
||||
let name = this.tok.type === tt.name ? this.tok.value : this.tok.type.keyword
|
||||
if (!name) return this.dummyIdent()
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.name = name
|
||||
return this.finishNode(node, "Identifier")
|
||||
}
|
||||
|
||||
lp.initFunction = function(node) {
|
||||
node.id = null
|
||||
node.params = []
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
node.generator = false
|
||||
node.expression = false
|
||||
}
|
||||
}
|
||||
|
||||
// Convert existing expression atom to assignable pattern
|
||||
// if possible.
|
||||
|
||||
lp.toAssignable = function(node, binding) {
|
||||
if (this.options.ecmaVersion >= 6 && node) {
|
||||
switch (node.type) {
|
||||
case "ObjectExpression":
|
||||
node.type = "ObjectPattern"
|
||||
let props = node.properties
|
||||
for (let i = 0; i < props.length; i++)
|
||||
this.toAssignable(props[i].value, binding)
|
||||
break
|
||||
|
||||
case "ArrayExpression":
|
||||
node.type = "ArrayPattern"
|
||||
this.toAssignableList(node.elements, binding)
|
||||
break
|
||||
|
||||
case "SpreadElement":
|
||||
node.type = "RestElement"
|
||||
node.argument = this.toAssignable(node.argument, binding)
|
||||
break
|
||||
|
||||
case "AssignmentExpression":
|
||||
node.type = "AssignmentPattern"
|
||||
break
|
||||
}
|
||||
}
|
||||
return this.checkLVal(node, binding)
|
||||
}
|
||||
|
||||
lp.toAssignableList = function(exprList, binding) {
|
||||
for (let i = 0; i < exprList.length; i++)
|
||||
exprList[i] = this.toAssignable(exprList[i], binding)
|
||||
return exprList
|
||||
}
|
||||
|
||||
lp.parseFunctionParams = function(params) {
|
||||
params = this.parseExprList(tt.parenR)
|
||||
return this.toAssignableList(params, true)
|
||||
}
|
||||
|
||||
lp.parseMethod = function(isGenerator) {
|
||||
let node = this.startNode()
|
||||
this.initFunction(node)
|
||||
node.params = this.parseFunctionParams()
|
||||
node.generator = isGenerator || false
|
||||
node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== tt.braceL
|
||||
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock()
|
||||
return this.finishNode(node, "FunctionExpression")
|
||||
}
|
||||
|
||||
lp.parseArrowExpression = function(node, params) {
|
||||
this.initFunction(node)
|
||||
node.params = this.toAssignableList(params, true)
|
||||
node.expression = this.tok.type !== tt.braceL
|
||||
node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock()
|
||||
return this.finishNode(node, "ArrowFunctionExpression")
|
||||
}
|
||||
|
||||
lp.parseExprList = function(close, allowEmpty) {
|
||||
this.pushCx()
|
||||
let indent = this.curIndent, line = this.curLineStart, elts = []
|
||||
this.next(); // Opening bracket
|
||||
while (!this.closes(close, indent + 1, line)) {
|
||||
if (this.eat(tt.comma)) {
|
||||
elts.push(allowEmpty ? null : this.dummyIdent())
|
||||
continue
|
||||
}
|
||||
let elt = this.parseMaybeAssign()
|
||||
if (isDummy(elt)) {
|
||||
if (this.closes(close, indent, line)) break
|
||||
this.next()
|
||||
} else {
|
||||
elts.push(elt)
|
||||
}
|
||||
this.eat(tt.comma)
|
||||
}
|
||||
this.popCx()
|
||||
if (!this.eat(close)) {
|
||||
// If there is no closing brace, make the node span to the start
|
||||
// of the next token (this is useful for Tern)
|
||||
this.last.end = this.tok.start
|
||||
if (this.options.locations) this.last.loc.end = this.tok.loc.start
|
||||
}
|
||||
return elts
|
||||
}
|
50
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/index.js
generated
vendored
Normal file
50
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Acorn: Loose parser
|
||||
//
|
||||
// This module provides an alternative parser (`parse_dammit`) that
|
||||
// exposes that same interface as `parse`, but will try to parse
|
||||
// anything as JavaScript, repairing syntax error the best it can.
|
||||
// There are circumstances in which it will raise an error and give
|
||||
// up, but they are very rare. The resulting AST will be a mostly
|
||||
// valid JavaScript AST (as per the [Mozilla parser API][api], except
|
||||
// that:
|
||||
//
|
||||
// - Return outside functions is allowed
|
||||
//
|
||||
// - Label consistency (no conflicts, break only to existing labels)
|
||||
// is not enforced.
|
||||
//
|
||||
// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
|
||||
// the parser got too confused to return anything meaningful.
|
||||
//
|
||||
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
|
||||
//
|
||||
// The expected use for this is to *first* try `acorn.parse`, and only
|
||||
// if that fails switch to `parse_dammit`. The loose parser might
|
||||
// parse badly indented code incorrectly, so **don't** use it as
|
||||
// your default parser.
|
||||
//
|
||||
// Quite a lot of acorn.js is duplicated here. The alternative was to
|
||||
// add a *lot* of extra cruft to that file, making it less readable
|
||||
// and slower. Copying and editing the code allowed me to make
|
||||
// invasive changes and simplifications without creating a complicated
|
||||
// tangle.
|
||||
|
||||
import * as acorn from ".."
|
||||
import {LooseParser} from "./state"
|
||||
import "./tokenize"
|
||||
import "./parseutil"
|
||||
import "./statement"
|
||||
import "./expression"
|
||||
|
||||
export {LooseParser} from "./state"
|
||||
|
||||
acorn.defaultOptions.tabSize = 4
|
||||
|
||||
export function parse_dammit(input, options) {
|
||||
let p = new LooseParser(input, options)
|
||||
p.next()
|
||||
return p.parseTopLevel()
|
||||
}
|
||||
|
||||
acorn.parse_dammit = parse_dammit
|
||||
acorn.LooseParser = LooseParser
|
126
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/parseutil.js
generated
vendored
Normal file
126
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/parseutil.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
import {LooseParser} from "./state"
|
||||
import {Node, SourceLocation, lineBreak, isNewLine, tokTypes as tt} from ".."
|
||||
|
||||
const lp = LooseParser.prototype
|
||||
|
||||
lp.startNode = function() {
|
||||
let node = new Node
|
||||
node.start = this.tok.start
|
||||
if (this.options.locations)
|
||||
node.loc = new SourceLocation(this.toks, this.tok.loc.start)
|
||||
if (this.options.directSourceFile)
|
||||
node.sourceFile = this.options.directSourceFile
|
||||
if (this.options.ranges)
|
||||
node.range = [this.tok.start, 0]
|
||||
return node
|
||||
}
|
||||
|
||||
lp.storeCurrentPos = function() {
|
||||
return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
|
||||
}
|
||||
|
||||
lp.startNodeAt = function(pos) {
|
||||
let node = new Node
|
||||
if (this.options.locations) {
|
||||
node.start = pos[0]
|
||||
node.loc = new SourceLocation(this.toks, pos[1])
|
||||
pos = pos[0]
|
||||
} else {
|
||||
node.start = pos
|
||||
}
|
||||
if (this.options.directSourceFile)
|
||||
node.sourceFile = this.options.directSourceFile
|
||||
if (this.options.ranges)
|
||||
node.range = [pos, 0]
|
||||
return node
|
||||
}
|
||||
|
||||
lp.finishNode = function(node, type) {
|
||||
node.type = type
|
||||
node.end = this.last.end
|
||||
if (this.options.locations)
|
||||
node.loc.end = this.last.loc.end
|
||||
if (this.options.ranges)
|
||||
node.range[1] = this.last.end
|
||||
return node
|
||||
}
|
||||
|
||||
lp.dummyIdent = function() {
|
||||
let dummy = this.startNode()
|
||||
dummy.name = "✖"
|
||||
return this.finishNode(dummy, "Identifier")
|
||||
}
|
||||
|
||||
export function isDummy(node) { return node.name == "✖" }
|
||||
|
||||
lp.eat = function(type) {
|
||||
if (this.tok.type === type) {
|
||||
this.next()
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
lp.isContextual = function(name) {
|
||||
return this.tok.type === tt.name && this.tok.value === name
|
||||
}
|
||||
|
||||
lp.eatContextual = function(name) {
|
||||
return this.tok.value === name && this.eat(tt.name)
|
||||
}
|
||||
|
||||
lp.canInsertSemicolon = function() {
|
||||
return this.tok.type === tt.eof || this.tok.type === tt.braceR ||
|
||||
lineBreak.test(this.input.slice(this.last.end, this.tok.start))
|
||||
}
|
||||
|
||||
lp.semicolon = function() {
|
||||
return this.eat(tt.semi)
|
||||
}
|
||||
|
||||
lp.expect = function(type) {
|
||||
if (this.eat(type)) return true
|
||||
for (let i = 1; i <= 2; i++) {
|
||||
if (this.lookAhead(i).type == type) {
|
||||
for (let j = 0; j < i; j++) this.next()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lp.pushCx = function() {
|
||||
this.context.push(this.curIndent)
|
||||
}
|
||||
lp.popCx = function() {
|
||||
this.curIndent = this.context.pop()
|
||||
}
|
||||
|
||||
lp.lineEnd = function(pos) {
|
||||
while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) ++pos
|
||||
return pos
|
||||
}
|
||||
|
||||
lp.indentationAfter = function(pos) {
|
||||
for (let count = 0;; ++pos) {
|
||||
let ch = this.input.charCodeAt(pos)
|
||||
if (ch === 32) ++count
|
||||
else if (ch === 9) count += this.options.tabSize
|
||||
else return count
|
||||
}
|
||||
}
|
||||
|
||||
lp.closes = function(closeTok, indent, line, blockHeuristic) {
|
||||
if (this.tok.type === closeTok || this.tok.type === tt.eof) return true
|
||||
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
|
||||
(!blockHeuristic || this.nextLineStart >= this.input.length ||
|
||||
this.indentationAfter(this.nextLineStart) < indent)
|
||||
}
|
||||
|
||||
lp.tokenStartsLine = function() {
|
||||
for (let p = this.tok.start - 1; p >= this.curLineStart; --p) {
|
||||
let ch = this.input.charCodeAt(p)
|
||||
if (ch !== 9 && ch !== 32) return false
|
||||
}
|
||||
return true
|
||||
}
|
17
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/state.js
generated
vendored
Normal file
17
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/state.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {tokenizer, SourceLocation, tokTypes as tt} from ".."
|
||||
|
||||
export function LooseParser(input, options) {
|
||||
this.toks = tokenizer(input, options)
|
||||
this.options = this.toks.options
|
||||
this.input = this.toks.input
|
||||
this.tok = this.last = {type: tt.eof, start: 0, end: 0}
|
||||
if (this.options.locations) {
|
||||
let here = this.toks.curPosition()
|
||||
this.tok.loc = new SourceLocation(this.toks, here, here)
|
||||
}
|
||||
this.ahead = []; // Tokens ahead
|
||||
this.context = []; // Indentation contexted
|
||||
this.curIndent = 0
|
||||
this.curLineStart = 0
|
||||
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
|
||||
}
|
419
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/statement.js
generated
vendored
Normal file
419
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/statement.js
generated
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
import {LooseParser} from "./state"
|
||||
import {isDummy} from "./parseutil"
|
||||
import {getLineInfo, tokTypes as tt} from ".."
|
||||
|
||||
const lp = LooseParser.prototype
|
||||
|
||||
lp.parseTopLevel = function() {
|
||||
let node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0)
|
||||
node.body = []
|
||||
while (this.tok.type !== tt.eof) node.body.push(this.parseStatement())
|
||||
this.last = this.tok
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
node.sourceType = this.options.sourceType
|
||||
}
|
||||
return this.finishNode(node, "Program")
|
||||
}
|
||||
|
||||
lp.parseStatement = function() {
|
||||
let starttype = this.tok.type, node = this.startNode()
|
||||
|
||||
switch (starttype) {
|
||||
case tt._break: case tt._continue:
|
||||
this.next()
|
||||
let isBreak = starttype === tt._break
|
||||
if (this.semicolon() || this.canInsertSemicolon()) {
|
||||
node.label = null
|
||||
} else {
|
||||
node.label = this.tok.type === tt.name ? this.parseIdent() : null
|
||||
this.semicolon()
|
||||
}
|
||||
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
||||
|
||||
case tt._debugger:
|
||||
this.next()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "DebuggerStatement")
|
||||
|
||||
case tt._do:
|
||||
this.next()
|
||||
node.body = this.parseStatement()
|
||||
node.test = this.eat(tt._while) ? this.parseParenExpression() : this.dummyIdent()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "DoWhileStatement")
|
||||
|
||||
case tt._for:
|
||||
this.next()
|
||||
this.pushCx()
|
||||
this.expect(tt.parenL)
|
||||
if (this.tok.type === tt.semi) return this.parseFor(node, null)
|
||||
if (this.tok.type === tt._var || this.tok.type === tt._let || this.tok.type === tt._const) {
|
||||
let init = this.parseVar(true)
|
||||
if (init.declarations.length === 1 && (this.tok.type === tt._in || this.isContextual("of"))) {
|
||||
return this.parseForIn(node, init)
|
||||
}
|
||||
return this.parseFor(node, init)
|
||||
}
|
||||
let init = this.parseExpression(true)
|
||||
if (this.tok.type === tt._in || this.isContextual("of"))
|
||||
return this.parseForIn(node, this.toAssignable(init))
|
||||
return this.parseFor(node, init)
|
||||
|
||||
case tt._function:
|
||||
this.next()
|
||||
return this.parseFunction(node, true)
|
||||
|
||||
case tt._if:
|
||||
this.next()
|
||||
node.test = this.parseParenExpression()
|
||||
node.consequent = this.parseStatement()
|
||||
node.alternate = this.eat(tt._else) ? this.parseStatement() : null
|
||||
return this.finishNode(node, "IfStatement")
|
||||
|
||||
case tt._return:
|
||||
this.next()
|
||||
if (this.eat(tt.semi) || this.canInsertSemicolon()) node.argument = null
|
||||
else { node.argument = this.parseExpression(); this.semicolon() }
|
||||
return this.finishNode(node, "ReturnStatement")
|
||||
|
||||
case tt._switch:
|
||||
let blockIndent = this.curIndent, line = this.curLineStart
|
||||
this.next()
|
||||
node.discriminant = this.parseParenExpression()
|
||||
node.cases = []
|
||||
this.pushCx()
|
||||
this.expect(tt.braceL)
|
||||
|
||||
let cur
|
||||
while (!this.closes(tt.braceR, blockIndent, line, true)) {
|
||||
if (this.tok.type === tt._case || this.tok.type === tt._default) {
|
||||
let isCase = this.tok.type === tt._case
|
||||
if (cur) this.finishNode(cur, "SwitchCase")
|
||||
node.cases.push(cur = this.startNode())
|
||||
cur.consequent = []
|
||||
this.next()
|
||||
if (isCase) cur.test = this.parseExpression()
|
||||
else cur.test = null
|
||||
this.expect(tt.colon)
|
||||
} else {
|
||||
if (!cur) {
|
||||
node.cases.push(cur = this.startNode())
|
||||
cur.consequent = []
|
||||
cur.test = null
|
||||
}
|
||||
cur.consequent.push(this.parseStatement())
|
||||
}
|
||||
}
|
||||
if (cur) this.finishNode(cur, "SwitchCase")
|
||||
this.popCx()
|
||||
this.eat(tt.braceR)
|
||||
return this.finishNode(node, "SwitchStatement")
|
||||
|
||||
case tt._throw:
|
||||
this.next()
|
||||
node.argument = this.parseExpression()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ThrowStatement")
|
||||
|
||||
case tt._try:
|
||||
this.next()
|
||||
node.block = this.parseBlock()
|
||||
node.handler = null
|
||||
if (this.tok.type === tt._catch) {
|
||||
let clause = this.startNode()
|
||||
this.next()
|
||||
this.expect(tt.parenL)
|
||||
clause.param = this.toAssignable(this.parseExprAtom(), true)
|
||||
this.expect(tt.parenR)
|
||||
clause.guard = null
|
||||
clause.body = this.parseBlock()
|
||||
node.handler = this.finishNode(clause, "CatchClause")
|
||||
}
|
||||
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null
|
||||
if (!node.handler && !node.finalizer) return node.block
|
||||
return this.finishNode(node, "TryStatement")
|
||||
|
||||
case tt._var:
|
||||
case tt._let:
|
||||
case tt._const:
|
||||
return this.parseVar()
|
||||
|
||||
case tt._while:
|
||||
this.next()
|
||||
node.test = this.parseParenExpression()
|
||||
node.body = this.parseStatement()
|
||||
return this.finishNode(node, "WhileStatement")
|
||||
|
||||
case tt._with:
|
||||
this.next()
|
||||
node.object = this.parseParenExpression()
|
||||
node.body = this.parseStatement()
|
||||
return this.finishNode(node, "WithStatement")
|
||||
|
||||
case tt.braceL:
|
||||
return this.parseBlock()
|
||||
|
||||
case tt.semi:
|
||||
this.next()
|
||||
return this.finishNode(node, "EmptyStatement")
|
||||
|
||||
case tt._class:
|
||||
return this.parseClass(true)
|
||||
|
||||
case tt._import:
|
||||
return this.parseImport()
|
||||
|
||||
case tt._export:
|
||||
return this.parseExport()
|
||||
|
||||
default:
|
||||
let expr = this.parseExpression()
|
||||
if (isDummy(expr)) {
|
||||
this.next()
|
||||
if (this.tok.type === tt.eof) return this.finishNode(node, "EmptyStatement")
|
||||
return this.parseStatement()
|
||||
} else if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) {
|
||||
node.body = this.parseStatement()
|
||||
node.label = expr
|
||||
return this.finishNode(node, "LabeledStatement")
|
||||
} else {
|
||||
node.expression = expr
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ExpressionStatement")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lp.parseBlock = function() {
|
||||
let node = this.startNode()
|
||||
this.pushCx()
|
||||
this.expect(tt.braceL)
|
||||
let blockIndent = this.curIndent, line = this.curLineStart
|
||||
node.body = []
|
||||
while (!this.closes(tt.braceR, blockIndent, line, true))
|
||||
node.body.push(this.parseStatement())
|
||||
this.popCx()
|
||||
this.eat(tt.braceR)
|
||||
return this.finishNode(node, "BlockStatement")
|
||||
}
|
||||
|
||||
lp.parseFor = function(node, init) {
|
||||
node.init = init
|
||||
node.test = node.update = null
|
||||
if (this.eat(tt.semi) && this.tok.type !== tt.semi) node.test = this.parseExpression()
|
||||
if (this.eat(tt.semi) && this.tok.type !== tt.parenR) node.update = this.parseExpression()
|
||||
this.popCx()
|
||||
this.expect(tt.parenR)
|
||||
node.body = this.parseStatement()
|
||||
return this.finishNode(node, "ForStatement")
|
||||
}
|
||||
|
||||
lp.parseForIn = function(node, init) {
|
||||
let type = this.tok.type === tt._in ? "ForInStatement" : "ForOfStatement"
|
||||
this.next()
|
||||
node.left = init
|
||||
node.right = this.parseExpression()
|
||||
this.popCx()
|
||||
this.expect(tt.parenR)
|
||||
node.body = this.parseStatement()
|
||||
return this.finishNode(node, type)
|
||||
}
|
||||
|
||||
lp.parseVar = function(noIn) {
|
||||
let node = this.startNode()
|
||||
node.kind = this.tok.type.keyword
|
||||
this.next()
|
||||
node.declarations = []
|
||||
do {
|
||||
let decl = this.startNode()
|
||||
decl.id = this.options.ecmaVersion >= 6 ? this.toAssignable(this.parseExprAtom(), true) : this.parseIdent()
|
||||
decl.init = this.eat(tt.eq) ? this.parseMaybeAssign(noIn) : null
|
||||
node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
|
||||
} while (this.eat(tt.comma))
|
||||
if (!node.declarations.length) {
|
||||
let decl = this.startNode()
|
||||
decl.id = this.dummyIdent()
|
||||
node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
|
||||
}
|
||||
if (!noIn) this.semicolon()
|
||||
return this.finishNode(node, "VariableDeclaration")
|
||||
}
|
||||
|
||||
lp.parseClass = function(isStatement) {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
if (this.tok.type === tt.name) node.id = this.parseIdent()
|
||||
else if (isStatement) node.id = this.dummyIdent()
|
||||
else node.id = null
|
||||
node.superClass = this.eat(tt._extends) ? this.parseExpression() : null
|
||||
node.body = this.startNode()
|
||||
node.body.body = []
|
||||
this.pushCx()
|
||||
let indent = this.curIndent + 1, line = this.curLineStart
|
||||
this.eat(tt.braceL)
|
||||
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart }
|
||||
while (!this.closes(tt.braceR, indent, line)) {
|
||||
if (this.semicolon()) continue
|
||||
let method = this.startNode(), isGenerator
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
method.static = false
|
||||
isGenerator = this.eat(tt.star)
|
||||
}
|
||||
this.parsePropertyName(method)
|
||||
if (isDummy(method.key)) { if (isDummy(this.parseMaybeAssign())) this.next(); this.eat(tt.comma); continue }
|
||||
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
|
||||
(this.tok.type != tt.parenL && this.tok.type != tt.braceL)) {
|
||||
method.static = true
|
||||
isGenerator = this.eat(tt.star)
|
||||
this.parsePropertyName(method)
|
||||
} else {
|
||||
method.static = false
|
||||
}
|
||||
if (this.options.ecmaVersion >= 5 && method.key.type === "Identifier" &&
|
||||
!method.computed && (method.key.name === "get" || method.key.name === "set") &&
|
||||
this.tok.type !== tt.parenL && this.tok.type !== tt.braceL) {
|
||||
method.kind = method.key.name
|
||||
this.parsePropertyName(method)
|
||||
method.value = this.parseMethod(false)
|
||||
} else {
|
||||
if (!method.computed && !method.static && !isGenerator && (
|
||||
method.key.type === "Identifier" && method.key.name === "constructor" ||
|
||||
method.key.type === "Literal" && method.key.value === "constructor")) {
|
||||
method.kind = "constructor"
|
||||
} else {
|
||||
method.kind = "method"
|
||||
}
|
||||
method.value = this.parseMethod(isGenerator)
|
||||
}
|
||||
node.body.body.push(this.finishNode(method, "MethodDefinition"))
|
||||
}
|
||||
this.popCx()
|
||||
if (!this.eat(tt.braceR)) {
|
||||
// If there is no closing brace, make the node span to the start
|
||||
// of the next token (this is useful for Tern)
|
||||
this.last.end = this.tok.start
|
||||
if (this.options.locations) this.last.loc.end = this.tok.loc.start
|
||||
}
|
||||
this.semicolon()
|
||||
this.finishNode(node.body, "ClassBody")
|
||||
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
||||
}
|
||||
|
||||
lp.parseFunction = function(node, isStatement) {
|
||||
this.initFunction(node)
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
node.generator = this.eat(tt.star)
|
||||
}
|
||||
if (this.tok.type === tt.name) node.id = this.parseIdent()
|
||||
else if (isStatement) node.id = this.dummyIdent()
|
||||
node.params = this.parseFunctionParams()
|
||||
node.body = this.parseBlock()
|
||||
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
||||
}
|
||||
|
||||
lp.parseExport = function() {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
if (this.eat(tt.star)) {
|
||||
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
|
||||
return this.finishNode(node, "ExportAllDeclaration")
|
||||
}
|
||||
if (this.eat(tt._default)) {
|
||||
let expr = this.parseMaybeAssign()
|
||||
if (expr.id) {
|
||||
switch (expr.type) {
|
||||
case "FunctionExpression": expr.type = "FunctionDeclaration"; break
|
||||
case "ClassExpression": expr.type = "ClassDeclaration"; break
|
||||
}
|
||||
}
|
||||
node.declaration = expr
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ExportDefaultDeclaration")
|
||||
}
|
||||
if (this.tok.type.keyword) {
|
||||
node.declaration = this.parseStatement()
|
||||
node.specifiers = []
|
||||
node.source = null
|
||||
} else {
|
||||
node.declaration = null
|
||||
node.specifiers = this.parseExportSpecifierList()
|
||||
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
|
||||
this.semicolon()
|
||||
}
|
||||
return this.finishNode(node, "ExportNamedDeclaration")
|
||||
}
|
||||
|
||||
lp.parseImport = function() {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
if (this.tok.type === tt.string) {
|
||||
node.specifiers = []
|
||||
node.source = this.parseExprAtom()
|
||||
node.kind = ''
|
||||
} else {
|
||||
let elt
|
||||
if (this.tok.type === tt.name && this.tok.value !== "from") {
|
||||
elt = this.startNode()
|
||||
elt.local = this.parseIdent()
|
||||
this.finishNode(elt, "ImportDefaultSpecifier")
|
||||
this.eat(tt.comma)
|
||||
}
|
||||
node.specifiers = this.parseImportSpecifierList()
|
||||
node.source = this.eatContextual("from") ? this.parseExprAtom() : null
|
||||
if (elt) node.specifiers.unshift(elt)
|
||||
}
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ImportDeclaration")
|
||||
}
|
||||
|
||||
lp.parseImportSpecifierList = function() {
|
||||
let elts = []
|
||||
if (this.tok.type === tt.star) {
|
||||
let elt = this.startNode()
|
||||
this.next()
|
||||
if (this.eatContextual("as")) elt.local = this.parseIdent()
|
||||
elts.push(this.finishNode(elt, "ImportNamespaceSpecifier"))
|
||||
} else {
|
||||
let indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart
|
||||
this.pushCx()
|
||||
this.eat(tt.braceL)
|
||||
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart
|
||||
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
||||
let elt = this.startNode()
|
||||
if (this.eat(tt.star)) {
|
||||
if (this.eatContextual("as")) elt.local = this.parseIdent()
|
||||
this.finishNode(elt, "ImportNamespaceSpecifier")
|
||||
} else {
|
||||
if (this.isContextual("from")) break
|
||||
elt.imported = this.parseIdent()
|
||||
elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported
|
||||
this.finishNode(elt, "ImportSpecifier")
|
||||
}
|
||||
elts.push(elt)
|
||||
this.eat(tt.comma)
|
||||
}
|
||||
this.eat(tt.braceR)
|
||||
this.popCx()
|
||||
}
|
||||
return elts
|
||||
}
|
||||
|
||||
lp.parseExportSpecifierList = function() {
|
||||
let elts = []
|
||||
let indent = this.curIndent, line = this.curLineStart, continuedLine = this.nextLineStart
|
||||
this.pushCx()
|
||||
this.eat(tt.braceL)
|
||||
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart
|
||||
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
|
||||
if (this.isContextual("from")) break
|
||||
let elt = this.startNode()
|
||||
elt.local = this.parseIdent()
|
||||
elt.exported = this.eatContextual("as") ? this.parseIdent() : elt.local
|
||||
this.finishNode(elt, "ExportSpecifier")
|
||||
elts.push(elt)
|
||||
this.eat(tt.comma)
|
||||
}
|
||||
this.eat(tt.braceR)
|
||||
this.popCx()
|
||||
return elts
|
||||
}
|
108
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/tokenize.js
generated
vendored
Normal file
108
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/loose/tokenize.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
import {tokTypes as tt, Token, isNewLine, SourceLocation, getLineInfo, lineBreakG} from ".."
|
||||
import {LooseParser} from "./state"
|
||||
|
||||
const lp = LooseParser.prototype
|
||||
|
||||
function isSpace(ch) {
|
||||
return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || isNewLine(ch)
|
||||
}
|
||||
|
||||
lp.next = function() {
|
||||
this.last = this.tok
|
||||
if (this.ahead.length)
|
||||
this.tok = this.ahead.shift()
|
||||
else
|
||||
this.tok = this.readToken()
|
||||
|
||||
if (this.tok.start >= this.nextLineStart) {
|
||||
while (this.tok.start >= this.nextLineStart) {
|
||||
this.curLineStart = this.nextLineStart
|
||||
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
|
||||
}
|
||||
this.curIndent = this.indentationAfter(this.curLineStart)
|
||||
}
|
||||
}
|
||||
|
||||
lp.readToken = function() {
|
||||
for (;;) {
|
||||
try {
|
||||
this.toks.next()
|
||||
if (this.toks.type === tt.dot &&
|
||||
this.input.substr(this.toks.end, 1) === "." &&
|
||||
this.options.ecmaVersion >= 6) {
|
||||
this.toks.end++
|
||||
this.toks.type = tt.ellipsis
|
||||
}
|
||||
return new Token(this.toks)
|
||||
} catch(e) {
|
||||
if (!(e instanceof SyntaxError)) throw e
|
||||
|
||||
// Try to skip some text, based on the error message, and then continue
|
||||
let msg = e.message, pos = e.raisedAt, replace = true
|
||||
if (/unterminated/i.test(msg)) {
|
||||
pos = this.lineEnd(e.pos + 1)
|
||||
if (/string/.test(msg)) {
|
||||
replace = {start: e.pos, end: pos, type: tt.string, value: this.input.slice(e.pos + 1, pos)}
|
||||
} else if (/regular expr/i.test(msg)) {
|
||||
let re = this.input.slice(e.pos, pos)
|
||||
try { re = new RegExp(re) } catch(e) {}
|
||||
replace = {start: e.pos, end: pos, type: tt.regexp, value: re}
|
||||
} else if (/template/.test(msg)) {
|
||||
replace = {start: e.pos, end: pos,
|
||||
type: tt.template,
|
||||
value: this.input.slice(e.pos, pos)}
|
||||
} else {
|
||||
replace = false
|
||||
}
|
||||
} else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
|
||||
while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos
|
||||
} else if (/character escape|expected hexadecimal/i.test(msg)) {
|
||||
while (pos < this.input.length) {
|
||||
let ch = this.input.charCodeAt(pos++)
|
||||
if (ch === 34 || ch === 39 || isNewLine(ch)) break
|
||||
}
|
||||
} else if (/unexpected character/i.test(msg)) {
|
||||
pos++
|
||||
replace = false
|
||||
} else if (/regular expression/i.test(msg)) {
|
||||
replace = true
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
this.resetTo(pos)
|
||||
if (replace === true) replace = {start: pos, end: pos, type: tt.name, value: "✖"}
|
||||
if (replace) {
|
||||
if (this.options.locations)
|
||||
replace.loc = new SourceLocation(
|
||||
this.toks,
|
||||
getLineInfo(this.input, replace.start),
|
||||
getLineInfo(this.input, replace.end))
|
||||
return replace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lp.resetTo = function(pos) {
|
||||
this.toks.pos = pos
|
||||
let ch = this.input.charAt(pos - 1)
|
||||
this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
|
||||
/[enwfd]/.test(ch) &&
|
||||
/\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos))
|
||||
|
||||
if (this.options.locations) {
|
||||
this.toks.curLine = 1
|
||||
this.toks.lineStart = lineBreakG.lastIndex = 0
|
||||
let match
|
||||
while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
|
||||
++this.toks.curLine
|
||||
this.toks.lineStart = match.index + match[0].length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lp.lookAhead = function(n) {
|
||||
while (n > this.ahead.length)
|
||||
this.ahead.push(this.readToken())
|
||||
return this.ahead[n - 1]
|
||||
}
|
213
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/lval.js
generated
vendored
Executable file
213
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/lval.js
generated
vendored
Executable file
@@ -0,0 +1,213 @@
|
||||
import {types as tt} from "./tokentype"
|
||||
import {Parser} from "./state"
|
||||
import {reservedWords} from "./identifier"
|
||||
import {has} from "./util"
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
// Convert existing expression atom to assignable pattern
|
||||
// if possible.
|
||||
|
||||
pp.toAssignable = function(node, isBinding) {
|
||||
if (this.options.ecmaVersion >= 6 && node) {
|
||||
switch (node.type) {
|
||||
case "Identifier":
|
||||
case "ObjectPattern":
|
||||
case "ArrayPattern":
|
||||
case "AssignmentPattern":
|
||||
break
|
||||
|
||||
case "ObjectExpression":
|
||||
node.type = "ObjectPattern"
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
let prop = node.properties[i]
|
||||
if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter")
|
||||
this.toAssignable(prop.value, isBinding)
|
||||
}
|
||||
break
|
||||
|
||||
case "ArrayExpression":
|
||||
node.type = "ArrayPattern"
|
||||
this.toAssignableList(node.elements, isBinding)
|
||||
break
|
||||
|
||||
case "AssignmentExpression":
|
||||
if (node.operator === "=") {
|
||||
node.type = "AssignmentPattern"
|
||||
} else {
|
||||
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.")
|
||||
}
|
||||
break
|
||||
|
||||
case "ParenthesizedExpression":
|
||||
node.expression = this.toAssignable(node.expression, isBinding)
|
||||
break
|
||||
|
||||
case "MemberExpression":
|
||||
if (!isBinding) break
|
||||
|
||||
default:
|
||||
this.raise(node.start, "Assigning to rvalue")
|
||||
}
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Convert list of expression atoms to binding list.
|
||||
|
||||
pp.toAssignableList = function(exprList, isBinding) {
|
||||
let end = exprList.length
|
||||
if (end) {
|
||||
let last = exprList[end - 1]
|
||||
if (last && last.type == "RestElement") {
|
||||
--end
|
||||
} else if (last && last.type == "SpreadElement") {
|
||||
last.type = "RestElement"
|
||||
let arg = last.argument
|
||||
this.toAssignable(arg, isBinding)
|
||||
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern")
|
||||
this.unexpected(arg.start)
|
||||
--end
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < end; i++) {
|
||||
let elt = exprList[i]
|
||||
if (elt) this.toAssignable(elt, isBinding)
|
||||
}
|
||||
return exprList
|
||||
}
|
||||
|
||||
// Parses spread element.
|
||||
|
||||
pp.parseSpread = function(refShorthandDefaultPos) {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.argument = this.parseMaybeAssign(refShorthandDefaultPos)
|
||||
return this.finishNode(node, "SpreadElement")
|
||||
}
|
||||
|
||||
pp.parseRest = function() {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()
|
||||
return this.finishNode(node, "RestElement")
|
||||
}
|
||||
|
||||
// Parses lvalue (assignable) atom.
|
||||
|
||||
pp.parseBindingAtom = function() {
|
||||
if (this.options.ecmaVersion < 6) return this.parseIdent()
|
||||
switch (this.type) {
|
||||
case tt.name:
|
||||
return this.parseIdent()
|
||||
|
||||
case tt.bracketL:
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
node.elements = this.parseBindingList(tt.bracketR, true, true)
|
||||
return this.finishNode(node, "ArrayPattern")
|
||||
|
||||
case tt.braceL:
|
||||
return this.parseObj(true)
|
||||
|
||||
default:
|
||||
this.unexpected()
|
||||
}
|
||||
}
|
||||
|
||||
pp.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
||||
let elts = [], first = true
|
||||
while (!this.eat(close)) {
|
||||
if (first) first = false
|
||||
else this.expect(tt.comma)
|
||||
if (allowEmpty && this.type === tt.comma) {
|
||||
elts.push(null)
|
||||
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
||||
break
|
||||
} else if (this.type === tt.ellipsis) {
|
||||
let rest = this.parseRest()
|
||||
this.parseBindingListItem(rest)
|
||||
elts.push(rest)
|
||||
this.expect(close)
|
||||
break
|
||||
} else {
|
||||
let elem = this.parseMaybeDefault(this.start, this.startLoc)
|
||||
this.parseBindingListItem(elem)
|
||||
elts.push(elem)
|
||||
}
|
||||
}
|
||||
return elts
|
||||
}
|
||||
|
||||
pp.parseBindingListItem = function(param) {
|
||||
return param
|
||||
}
|
||||
|
||||
// Parses assignment pattern around given atom if possible.
|
||||
|
||||
pp.parseMaybeDefault = function(startPos, startLoc, left) {
|
||||
if (Array.isArray(startPos)){
|
||||
if (this.options.locations && noCalls === undefined) {
|
||||
// shift arguments to left by one
|
||||
left = startLoc
|
||||
// flatten startPos
|
||||
startLoc = startPos[1]
|
||||
startPos = startPos[0]
|
||||
}
|
||||
}
|
||||
left = left || this.parseBindingAtom()
|
||||
if (!this.eat(tt.eq)) return left
|
||||
let node = this.startNodeAt(startPos, startLoc)
|
||||
node.operator = "="
|
||||
node.left = left
|
||||
node.right = this.parseMaybeAssign()
|
||||
return this.finishNode(node, "AssignmentPattern")
|
||||
}
|
||||
|
||||
// Verify that a node is an lval — something that can be assigned
|
||||
// to.
|
||||
|
||||
pp.checkLVal = function(expr, isBinding, checkClashes) {
|
||||
switch (expr.type) {
|
||||
case "Identifier":
|
||||
if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name)))
|
||||
this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode")
|
||||
if (checkClashes) {
|
||||
if (has(checkClashes, expr.name))
|
||||
this.raise(expr.start, "Argument name clash in strict mode")
|
||||
checkClashes[expr.name] = true
|
||||
}
|
||||
break
|
||||
|
||||
case "MemberExpression":
|
||||
if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression")
|
||||
break
|
||||
|
||||
case "ObjectPattern":
|
||||
for (let i = 0; i < expr.properties.length; i++)
|
||||
this.checkLVal(expr.properties[i].value, isBinding, checkClashes)
|
||||
break
|
||||
|
||||
case "ArrayPattern":
|
||||
for (let i = 0; i < expr.elements.length; i++) {
|
||||
let elem = expr.elements[i]
|
||||
if (elem) this.checkLVal(elem, isBinding, checkClashes)
|
||||
}
|
||||
break
|
||||
|
||||
case "AssignmentPattern":
|
||||
this.checkLVal(expr.left, isBinding, checkClashes)
|
||||
break
|
||||
|
||||
case "RestElement":
|
||||
this.checkLVal(expr.argument, isBinding, checkClashes)
|
||||
break
|
||||
|
||||
case "ParenthesizedExpression":
|
||||
this.checkLVal(expr.expression, isBinding, checkClashes)
|
||||
break
|
||||
|
||||
default:
|
||||
this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue")
|
||||
}
|
||||
}
|
70
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/node.js
generated
vendored
Executable file
70
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/node.js
generated
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
import {Parser} from "./state"
|
||||
import {SourceLocation} from "./location"
|
||||
|
||||
// Start an AST node, attaching a start offset.
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
export class Node {}
|
||||
|
||||
pp.startNode = function() {
|
||||
let node = new Node
|
||||
node.start = this.start
|
||||
if (this.options.locations)
|
||||
node.loc = new SourceLocation(this, this.startLoc)
|
||||
if (this.options.directSourceFile)
|
||||
node.sourceFile = this.options.directSourceFile
|
||||
if (this.options.ranges)
|
||||
node.range = [this.start, 0]
|
||||
return node
|
||||
}
|
||||
|
||||
pp.startNodeAt = function(pos, loc) {
|
||||
let node = new Node
|
||||
if (Array.isArray(pos)){
|
||||
if (this.options.locations && loc === undefined) {
|
||||
// flatten pos
|
||||
loc = pos[1]
|
||||
pos = pos[0]
|
||||
}
|
||||
}
|
||||
node.start = pos
|
||||
if (this.options.locations)
|
||||
node.loc = new SourceLocation(this, loc)
|
||||
if (this.options.directSourceFile)
|
||||
node.sourceFile = this.options.directSourceFile
|
||||
if (this.options.ranges)
|
||||
node.range = [pos, 0]
|
||||
return node
|
||||
}
|
||||
|
||||
// Finish an AST node, adding `type` and `end` properties.
|
||||
|
||||
pp.finishNode = function(node, type) {
|
||||
node.type = type
|
||||
node.end = this.lastTokEnd
|
||||
if (this.options.locations)
|
||||
node.loc.end = this.lastTokEndLoc
|
||||
if (this.options.ranges)
|
||||
node.range[1] = this.lastTokEnd
|
||||
return node
|
||||
}
|
||||
|
||||
// Finish node at given position
|
||||
|
||||
pp.finishNodeAt = function(node, type, pos, loc) {
|
||||
node.type = type
|
||||
if (Array.isArray(pos)){
|
||||
if (this.options.locations && loc === undefined) {
|
||||
// flatten pos
|
||||
loc = pos[1]
|
||||
pos = pos[0]
|
||||
}
|
||||
}
|
||||
node.end = pos
|
||||
if (this.options.locations)
|
||||
node.loc.end = loc
|
||||
if (this.options.ranges)
|
||||
node.range[1] = pos
|
||||
return node
|
||||
}
|
119
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/options.js
generated
vendored
Normal file
119
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/options.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
import {has, isArray} from "./util"
|
||||
import {SourceLocation} from "./location"
|
||||
|
||||
// A second optional argument can be given to further configure
|
||||
// the parser process. These options are recognized:
|
||||
|
||||
export const defaultOptions = {
|
||||
// `ecmaVersion` indicates the ECMAScript version to parse. Must
|
||||
// be either 3, or 5, or 6. This influences support for strict
|
||||
// mode, the set of reserved words, support for getters and
|
||||
// setters and other features.
|
||||
ecmaVersion: 5,
|
||||
// Source type ("script" or "module") for different semantics
|
||||
sourceType: "script",
|
||||
// `onInsertedSemicolon` can be a callback that will be called
|
||||
// when a semicolon is automatically inserted. It will be passed
|
||||
// th position of the comma as an offset, and if `locations` is
|
||||
// enabled, it is given the location as a `{line, column}` object
|
||||
// as second argument.
|
||||
onInsertedSemicolon: null,
|
||||
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
|
||||
// trailing commas.
|
||||
onTrailingComma: null,
|
||||
// By default, reserved words are not enforced. Disable
|
||||
// `allowReserved` to enforce them. When this option has the
|
||||
// value "never", reserved words and keywords can also not be
|
||||
// used as property names.
|
||||
allowReserved: true,
|
||||
// When enabled, a return at the top level is not considered an
|
||||
// error.
|
||||
allowReturnOutsideFunction: false,
|
||||
// When enabled, import/export statements are not constrained to
|
||||
// appearing at the top of the program.
|
||||
allowImportExportEverywhere: false,
|
||||
// When enabled, hashbang directive in the beginning of file
|
||||
// is allowed and treated as a line comment.
|
||||
allowHashBang: false,
|
||||
// When `locations` is on, `loc` properties holding objects with
|
||||
// `start` and `end` properties in `{line, column}` form (with
|
||||
// line being 1-based and column 0-based) will be attached to the
|
||||
// nodes.
|
||||
locations: false,
|
||||
// A function can be passed as `onToken` option, which will
|
||||
// cause Acorn to call that function with object in the same
|
||||
// format as tokenize() returns. Note that you are not
|
||||
// allowed to call the parser from the callback—that will
|
||||
// corrupt its internal state.
|
||||
onToken: null,
|
||||
// A function can be passed as `onComment` option, which will
|
||||
// cause Acorn to call that function with `(block, text, start,
|
||||
// end)` parameters whenever a comment is skipped. `block` is a
|
||||
// boolean indicating whether this is a block (`/* */`) comment,
|
||||
// `text` is the content of the comment, and `start` and `end` are
|
||||
// character offsets that denote the start and end of the comment.
|
||||
// When the `locations` option is on, two more parameters are
|
||||
// passed, the full `{line, column}` locations of the start and
|
||||
// end of the comments. Note that you are not allowed to call the
|
||||
// parser from the callback—that will corrupt its internal state.
|
||||
onComment: null,
|
||||
// Nodes have their start and end characters offsets recorded in
|
||||
// `start` and `end` properties (directly on the node, rather than
|
||||
// the `loc` object, which holds line/column data. To also add a
|
||||
// [semi-standardized][range] `range` property holding a `[start,
|
||||
// end]` array with the same numbers, set the `ranges` option to
|
||||
// `true`.
|
||||
//
|
||||
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
|
||||
ranges: false,
|
||||
// It is possible to parse multiple files into a single AST by
|
||||
// passing the tree produced by parsing the first file as
|
||||
// `program` option in subsequent parses. This will add the
|
||||
// toplevel forms of the parsed file to the `Program` (top) node
|
||||
// of an existing parse tree.
|
||||
program: null,
|
||||
// When `locations` is on, you can pass this to record the source
|
||||
// file in every node's `loc` object.
|
||||
sourceFile: null,
|
||||
// This value, if given, is stored in every node, whether
|
||||
// `locations` is on or off.
|
||||
directSourceFile: null,
|
||||
// When enabled, parenthesized expressions are represented by
|
||||
// (non-standard) ParenthesizedExpression nodes
|
||||
preserveParens: false,
|
||||
plugins: {}
|
||||
}
|
||||
|
||||
// Interpret and default an options object
|
||||
|
||||
export function getOptions(opts) {
|
||||
let options = {}
|
||||
for (let opt in defaultOptions)
|
||||
options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]
|
||||
|
||||
if (isArray(options.onToken)) {
|
||||
let tokens = options.onToken
|
||||
options.onToken = (token) => tokens.push(token)
|
||||
}
|
||||
if (isArray(options.onComment))
|
||||
options.onComment = pushComment(options, options.onComment)
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
function pushComment(options, array) {
|
||||
return function (block, text, start, end, startLoc, endLoc) {
|
||||
let comment = {
|
||||
type: block ? 'Block' : 'Line',
|
||||
value: text,
|
||||
start: start,
|
||||
end: end
|
||||
}
|
||||
if (options.locations)
|
||||
comment.loc = new SourceLocation(this, startLoc, endLoc)
|
||||
if (options.ranges)
|
||||
comment.range = [start, end]
|
||||
array.push(comment)
|
||||
}
|
||||
}
|
||||
|
89
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/parseutil.js
generated
vendored
Normal file
89
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/parseutil.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import {types as tt} from "./tokentype"
|
||||
import {Parser} from "./state"
|
||||
import {lineBreak} from "./whitespace"
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
// ## Parser utilities
|
||||
|
||||
// Test whether a statement node is the string literal `"use strict"`.
|
||||
|
||||
pp.isUseStrict = function(stmt) {
|
||||
return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" &&
|
||||
stmt.expression.type === "Literal" && stmt.expression.value === "use strict"
|
||||
}
|
||||
|
||||
// Predicate that tests whether the next token is of the given
|
||||
// type, and if yes, consumes it as a side effect.
|
||||
|
||||
pp.eat = function(type) {
|
||||
if (this.type === type) {
|
||||
this.next()
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Tests whether parsed token is a contextual keyword.
|
||||
|
||||
pp.isContextual = function(name) {
|
||||
return this.type === tt.name && this.value === name
|
||||
}
|
||||
|
||||
// Consumes contextual keyword if possible.
|
||||
|
||||
pp.eatContextual = function(name) {
|
||||
return this.value === name && this.eat(tt.name)
|
||||
}
|
||||
|
||||
// Asserts that following token is given contextual keyword.
|
||||
|
||||
pp.expectContextual = function(name) {
|
||||
if (!this.eatContextual(name)) this.unexpected()
|
||||
}
|
||||
|
||||
// Test whether a semicolon can be inserted at the current position.
|
||||
|
||||
pp.canInsertSemicolon = function() {
|
||||
return this.type === tt.eof ||
|
||||
this.type === tt.braceR ||
|
||||
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
||||
}
|
||||
|
||||
pp.insertSemicolon = function() {
|
||||
if (this.canInsertSemicolon()) {
|
||||
if (this.options.onInsertedSemicolon)
|
||||
this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Consume a semicolon, or, failing that, see if we are allowed to
|
||||
// pretend that there is a semicolon at this position.
|
||||
|
||||
pp.semicolon = function() {
|
||||
if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()
|
||||
}
|
||||
|
||||
pp.afterTrailingComma = function(tokType) {
|
||||
if (this.type == tokType) {
|
||||
if (this.options.onTrailingComma)
|
||||
this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)
|
||||
this.next()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Expect a token of a given type. If found, consume it, otherwise,
|
||||
// raise an unexpected token error.
|
||||
|
||||
pp.expect = function(type) {
|
||||
this.eat(type) || this.unexpected()
|
||||
}
|
||||
|
||||
// Raise an unexpected token error.
|
||||
|
||||
pp.unexpected = function(pos) {
|
||||
this.raise(pos != null ? pos : this.start, "Unexpected token")
|
||||
}
|
78
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/state.js
generated
vendored
Normal file
78
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/state.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import {reservedWords, keywords} from "./identifier"
|
||||
import {types as tt} from "./tokentype"
|
||||
import {lineBreak} from "./whitespace"
|
||||
|
||||
export function Parser(options, input, startPos) {
|
||||
this.options = options
|
||||
this.sourceFile = this.options.sourceFile || null
|
||||
this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5]
|
||||
this.isReservedWord = reservedWords[this.options.ecmaVersion]
|
||||
this.input = input
|
||||
|
||||
// Load plugins
|
||||
this.loadPlugins(this.options.plugins)
|
||||
|
||||
// Set up token state
|
||||
|
||||
// The current position of the tokenizer in the input.
|
||||
if (startPos) {
|
||||
this.pos = startPos
|
||||
this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos))
|
||||
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length
|
||||
} else {
|
||||
this.pos = this.lineStart = 0
|
||||
this.curLine = 1
|
||||
}
|
||||
|
||||
// Properties of the current token:
|
||||
// Its type
|
||||
this.type = tt.eof
|
||||
// For tokens that include more information than their type, the value
|
||||
this.value = null
|
||||
// Its start and end offset
|
||||
this.start = this.end = this.pos
|
||||
// And, if locations are used, the {line, column} object
|
||||
// corresponding to those offsets
|
||||
this.startLoc = this.endLoc = null
|
||||
|
||||
// Position information for the previous token
|
||||
this.lastTokEndLoc = this.lastTokStartLoc = null
|
||||
this.lastTokStart = this.lastTokEnd = this.pos
|
||||
|
||||
// The context stack is used to superficially track syntactic
|
||||
// context to predict whether a regular expression is allowed in a
|
||||
// given position.
|
||||
this.context = this.initialContext()
|
||||
this.exprAllowed = true
|
||||
|
||||
// Figure out if it's a module code.
|
||||
this.strict = this.inModule = this.options.sourceType === "module"
|
||||
|
||||
// Used to signify the start of a potential arrow function
|
||||
this.potentialArrowAt = -1
|
||||
|
||||
// Flags to track whether we are in a function, a generator.
|
||||
this.inFunction = this.inGenerator = false
|
||||
// Labels in scope.
|
||||
this.labels = []
|
||||
|
||||
// If enabled, skip leading hashbang line.
|
||||
if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === '#!')
|
||||
this.skipLineComment(2)
|
||||
}
|
||||
|
||||
Parser.prototype.extend = function(name, f) {
|
||||
this[name] = f(this[name])
|
||||
}
|
||||
|
||||
// Registered plugins
|
||||
|
||||
export const plugins = {}
|
||||
|
||||
Parser.prototype.loadPlugins = function(plugins) {
|
||||
for (let name in plugins) {
|
||||
let plugin = exports.plugins[name]
|
||||
if (!plugin) throw new Error("Plugin '" + name + "' not found")
|
||||
plugin(this, plugins[name])
|
||||
}
|
||||
}
|
594
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/statement.js
generated
vendored
Normal file
594
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/statement.js
generated
vendored
Normal file
@@ -0,0 +1,594 @@
|
||||
import {types as tt} from "./tokentype"
|
||||
import {Parser} from "./state"
|
||||
import {lineBreak} from "./whitespace"
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
// ### Statement parsing
|
||||
|
||||
// Parse a program. Initializes the parser, reads any number of
|
||||
// statements, and wraps them in a Program node. Optionally takes a
|
||||
// `program` argument. If present, the statements will be appended
|
||||
// to its body instead of creating a new node.
|
||||
|
||||
pp.parseTopLevel = function(node) {
|
||||
let first = true
|
||||
if (!node.body) node.body = []
|
||||
while (this.type !== tt.eof) {
|
||||
let stmt = this.parseStatement(true, true)
|
||||
node.body.push(stmt)
|
||||
if (first && this.isUseStrict(stmt)) this.setStrict(true)
|
||||
first = false
|
||||
}
|
||||
this.next()
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
node.sourceType = this.options.sourceType
|
||||
}
|
||||
return this.finishNode(node, "Program")
|
||||
}
|
||||
|
||||
const loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}
|
||||
|
||||
// Parse a single statement.
|
||||
//
|
||||
// If expecting a statement and finding a slash operator, parse a
|
||||
// regular expression literal. This is to handle cases like
|
||||
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
||||
// does not help.
|
||||
|
||||
pp.parseStatement = function(declaration, topLevel) {
|
||||
let starttype = this.type, node = this.startNode()
|
||||
|
||||
// Most types of statements are recognized by the keyword they
|
||||
// start with. Many are trivial to parse, some require a bit of
|
||||
// complexity.
|
||||
|
||||
switch (starttype) {
|
||||
case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
||||
case tt._debugger: return this.parseDebuggerStatement(node)
|
||||
case tt._do: return this.parseDoStatement(node)
|
||||
case tt._for: return this.parseForStatement(node)
|
||||
case tt._function:
|
||||
if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()
|
||||
return this.parseFunctionStatement(node)
|
||||
case tt._class:
|
||||
if (!declaration) this.unexpected()
|
||||
return this.parseClass(node, true)
|
||||
case tt._if: return this.parseIfStatement(node)
|
||||
case tt._return: return this.parseReturnStatement(node)
|
||||
case tt._switch: return this.parseSwitchStatement(node)
|
||||
case tt._throw: return this.parseThrowStatement(node)
|
||||
case tt._try: return this.parseTryStatement(node)
|
||||
case tt._let: case tt._const: if (!declaration) this.unexpected() // NOTE: falls through to _var
|
||||
case tt._var: return this.parseVarStatement(node, starttype)
|
||||
case tt._while: return this.parseWhileStatement(node)
|
||||
case tt._with: return this.parseWithStatement(node)
|
||||
case tt.braceL: return this.parseBlock()
|
||||
case tt.semi: return this.parseEmptyStatement(node)
|
||||
case tt._export:
|
||||
case tt._import:
|
||||
if (!this.options.allowImportExportEverywhere) {
|
||||
if (!topLevel)
|
||||
this.raise(this.start, "'import' and 'export' may only appear at the top level")
|
||||
if (!this.inModule)
|
||||
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")
|
||||
}
|
||||
return starttype === tt._import ? this.parseImport(node) : this.parseExport(node)
|
||||
|
||||
// If the statement does not start with a statement keyword or a
|
||||
// brace, it's an ExpressionStatement or LabeledStatement. We
|
||||
// simply start parsing an expression, and afterwards, if the
|
||||
// next token is a colon and the expression was a simple
|
||||
// Identifier node, we switch to interpreting it as a label.
|
||||
default:
|
||||
let maybeName = this.value, expr = this.parseExpression()
|
||||
if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon))
|
||||
return this.parseLabeledStatement(node, maybeName, expr)
|
||||
else return this.parseExpressionStatement(node, expr)
|
||||
}
|
||||
}
|
||||
|
||||
pp.parseBreakContinueStatement = function(node, keyword) {
|
||||
let isBreak = keyword == "break"
|
||||
this.next()
|
||||
if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null
|
||||
else if (this.type !== tt.name) this.unexpected()
|
||||
else {
|
||||
node.label = this.parseIdent()
|
||||
this.semicolon()
|
||||
}
|
||||
|
||||
// Verify that there is an actual destination to break or
|
||||
// continue to.
|
||||
for (var i = 0; i < this.labels.length; ++i) {
|
||||
let lab = this.labels[i]
|
||||
if (node.label == null || lab.name === node.label.name) {
|
||||
if (lab.kind != null && (isBreak || lab.kind === "loop")) break
|
||||
if (node.label && isBreak) break
|
||||
}
|
||||
}
|
||||
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword)
|
||||
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
||||
}
|
||||
|
||||
pp.parseDebuggerStatement = function(node) {
|
||||
this.next()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "DebuggerStatement")
|
||||
}
|
||||
|
||||
pp.parseDoStatement = function(node) {
|
||||
this.next()
|
||||
this.labels.push(loopLabel)
|
||||
node.body = this.parseStatement(false)
|
||||
this.labels.pop()
|
||||
this.expect(tt._while)
|
||||
node.test = this.parseParenExpression()
|
||||
if (this.options.ecmaVersion >= 6)
|
||||
this.eat(tt.semi)
|
||||
else
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "DoWhileStatement")
|
||||
}
|
||||
|
||||
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
|
||||
// loop is non-trivial. Basically, we have to parse the init `var`
|
||||
// statement or expression, disallowing the `in` operator (see
|
||||
// the second parameter to `parseExpression`), and then check
|
||||
// whether the next token is `in` or `of`. When there is no init
|
||||
// part (semicolon immediately after the opening parenthesis), it
|
||||
// is a regular `for` loop.
|
||||
|
||||
pp.parseForStatement = function(node) {
|
||||
this.next()
|
||||
this.labels.push(loopLabel)
|
||||
this.expect(tt.parenL)
|
||||
if (this.type === tt.semi) return this.parseFor(node, null)
|
||||
if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {
|
||||
let init = this.startNode(), varKind = this.type
|
||||
this.next()
|
||||
this.parseVar(init, true, varKind)
|
||||
this.finishNode(init, "VariableDeclaration")
|
||||
if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1 &&
|
||||
!(varKind !== tt._var && init.declarations[0].init))
|
||||
return this.parseForIn(node, init)
|
||||
return this.parseFor(node, init)
|
||||
}
|
||||
let refShorthandDefaultPos = {start: 0}
|
||||
let init = this.parseExpression(true, refShorthandDefaultPos)
|
||||
if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
||||
this.toAssignable(init)
|
||||
this.checkLVal(init)
|
||||
return this.parseForIn(node, init)
|
||||
} else if (refShorthandDefaultPos.start) {
|
||||
this.unexpected(refShorthandDefaultPos.start)
|
||||
}
|
||||
return this.parseFor(node, init)
|
||||
}
|
||||
|
||||
pp.parseFunctionStatement = function(node) {
|
||||
this.next()
|
||||
return this.parseFunction(node, true)
|
||||
}
|
||||
|
||||
pp.parseIfStatement = function(node) {
|
||||
this.next()
|
||||
node.test = this.parseParenExpression()
|
||||
node.consequent = this.parseStatement(false)
|
||||
node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null
|
||||
return this.finishNode(node, "IfStatement")
|
||||
}
|
||||
|
||||
pp.parseReturnStatement = function(node) {
|
||||
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
||||
this.raise(this.start, "'return' outside of function")
|
||||
this.next()
|
||||
|
||||
// In `return` (and `break`/`continue`), the keywords with
|
||||
// optional arguments, we eagerly look for a semicolon or the
|
||||
// possibility to insert one.
|
||||
|
||||
if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null
|
||||
else { node.argument = this.parseExpression(); this.semicolon() }
|
||||
return this.finishNode(node, "ReturnStatement")
|
||||
}
|
||||
|
||||
pp.parseSwitchStatement = function(node) {
|
||||
this.next()
|
||||
node.discriminant = this.parseParenExpression()
|
||||
node.cases = []
|
||||
this.expect(tt.braceL)
|
||||
this.labels.push(switchLabel)
|
||||
|
||||
// Statements under must be grouped (by label) in SwitchCase
|
||||
// nodes. `cur` is used to keep the node that we are currently
|
||||
// adding statements to.
|
||||
|
||||
for (var cur, sawDefault; this.type != tt.braceR;) {
|
||||
if (this.type === tt._case || this.type === tt._default) {
|
||||
let isCase = this.type === tt._case
|
||||
if (cur) this.finishNode(cur, "SwitchCase")
|
||||
node.cases.push(cur = this.startNode())
|
||||
cur.consequent = []
|
||||
this.next()
|
||||
if (isCase) {
|
||||
cur.test = this.parseExpression()
|
||||
} else {
|
||||
if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses")
|
||||
sawDefault = true
|
||||
cur.test = null
|
||||
}
|
||||
this.expect(tt.colon)
|
||||
} else {
|
||||
if (!cur) this.unexpected()
|
||||
cur.consequent.push(this.parseStatement(true))
|
||||
}
|
||||
}
|
||||
if (cur) this.finishNode(cur, "SwitchCase")
|
||||
this.next() // Closing brace
|
||||
this.labels.pop()
|
||||
return this.finishNode(node, "SwitchStatement")
|
||||
}
|
||||
|
||||
pp.parseThrowStatement = function(node) {
|
||||
this.next()
|
||||
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
||||
this.raise(this.lastTokEnd, "Illegal newline after throw")
|
||||
node.argument = this.parseExpression()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ThrowStatement")
|
||||
}
|
||||
|
||||
// Reused empty array added for node fields that are always empty.
|
||||
|
||||
const empty = []
|
||||
|
||||
pp.parseTryStatement = function(node) {
|
||||
this.next()
|
||||
node.block = this.parseBlock()
|
||||
node.handler = null
|
||||
if (this.type === tt._catch) {
|
||||
let clause = this.startNode()
|
||||
this.next()
|
||||
this.expect(tt.parenL)
|
||||
clause.param = this.parseBindingAtom()
|
||||
this.checkLVal(clause.param, true)
|
||||
this.expect(tt.parenR)
|
||||
clause.guard = null
|
||||
clause.body = this.parseBlock()
|
||||
node.handler = this.finishNode(clause, "CatchClause")
|
||||
}
|
||||
node.guardedHandlers = empty
|
||||
node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null
|
||||
if (!node.handler && !node.finalizer)
|
||||
this.raise(node.start, "Missing catch or finally clause")
|
||||
return this.finishNode(node, "TryStatement")
|
||||
}
|
||||
|
||||
pp.parseVarStatement = function(node, kind) {
|
||||
this.next()
|
||||
this.parseVar(node, false, kind)
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "VariableDeclaration")
|
||||
}
|
||||
|
||||
pp.parseWhileStatement = function(node) {
|
||||
this.next()
|
||||
node.test = this.parseParenExpression()
|
||||
this.labels.push(loopLabel)
|
||||
node.body = this.parseStatement(false)
|
||||
this.labels.pop()
|
||||
return this.finishNode(node, "WhileStatement")
|
||||
}
|
||||
|
||||
pp.parseWithStatement = function(node) {
|
||||
if (this.strict) this.raise(this.start, "'with' in strict mode")
|
||||
this.next()
|
||||
node.object = this.parseParenExpression()
|
||||
node.body = this.parseStatement(false)
|
||||
return this.finishNode(node, "WithStatement")
|
||||
}
|
||||
|
||||
pp.parseEmptyStatement = function(node) {
|
||||
this.next()
|
||||
return this.finishNode(node, "EmptyStatement")
|
||||
}
|
||||
|
||||
pp.parseLabeledStatement = function(node, maybeName, expr) {
|
||||
for (let i = 0; i < this.labels.length; ++i)
|
||||
if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared")
|
||||
let kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null
|
||||
this.labels.push({name: maybeName, kind: kind})
|
||||
node.body = this.parseStatement(true)
|
||||
this.labels.pop()
|
||||
node.label = expr
|
||||
return this.finishNode(node, "LabeledStatement")
|
||||
}
|
||||
|
||||
pp.parseExpressionStatement = function(node, expr) {
|
||||
node.expression = expr
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ExpressionStatement")
|
||||
}
|
||||
|
||||
// Parse a semicolon-enclosed block of statements, handling `"use
|
||||
// strict"` declarations when `allowStrict` is true (used for
|
||||
// function bodies).
|
||||
|
||||
pp.parseBlock = function(allowStrict) {
|
||||
let node = this.startNode(), first = true, oldStrict
|
||||
node.body = []
|
||||
this.expect(tt.braceL)
|
||||
while (!this.eat(tt.braceR)) {
|
||||
let stmt = this.parseStatement(true)
|
||||
node.body.push(stmt)
|
||||
if (first && allowStrict && this.isUseStrict(stmt)) {
|
||||
oldStrict = this.strict
|
||||
this.setStrict(this.strict = true)
|
||||
}
|
||||
first = false
|
||||
}
|
||||
if (oldStrict === false) this.setStrict(false)
|
||||
return this.finishNode(node, "BlockStatement")
|
||||
}
|
||||
|
||||
// Parse a regular `for` loop. The disambiguation code in
|
||||
// `parseStatement` will already have parsed the init statement or
|
||||
// expression.
|
||||
|
||||
pp.parseFor = function(node, init) {
|
||||
node.init = init
|
||||
this.expect(tt.semi)
|
||||
node.test = this.type === tt.semi ? null : this.parseExpression()
|
||||
this.expect(tt.semi)
|
||||
node.update = this.type === tt.parenR ? null : this.parseExpression()
|
||||
this.expect(tt.parenR)
|
||||
node.body = this.parseStatement(false)
|
||||
this.labels.pop()
|
||||
return this.finishNode(node, "ForStatement")
|
||||
}
|
||||
|
||||
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
||||
// same from parser's perspective.
|
||||
|
||||
pp.parseForIn = function(node, init) {
|
||||
let type = this.type === tt._in ? "ForInStatement" : "ForOfStatement"
|
||||
this.next()
|
||||
node.left = init
|
||||
node.right = this.parseExpression()
|
||||
this.expect(tt.parenR)
|
||||
node.body = this.parseStatement(false)
|
||||
this.labels.pop()
|
||||
return this.finishNode(node, type)
|
||||
}
|
||||
|
||||
// Parse a list of variable declarations.
|
||||
|
||||
pp.parseVar = function(node, isFor, kind) {
|
||||
node.declarations = []
|
||||
node.kind = kind.keyword
|
||||
for (;;) {
|
||||
let decl = this.startNode()
|
||||
this.parseVarId(decl)
|
||||
if (this.eat(tt.eq)) {
|
||||
decl.init = this.parseMaybeAssign(isFor)
|
||||
} else if (kind === tt._const && !(this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
||||
this.unexpected()
|
||||
} else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {
|
||||
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value")
|
||||
} else {
|
||||
decl.init = null
|
||||
}
|
||||
node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
|
||||
if (!this.eat(tt.comma)) break
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
pp.parseVarId = function(decl) {
|
||||
decl.id = this.parseBindingAtom()
|
||||
this.checkLVal(decl.id, true)
|
||||
}
|
||||
|
||||
// Parse a function declaration or literal (depending on the
|
||||
// `isStatement` parameter).
|
||||
|
||||
pp.parseFunction = function(node, isStatement, allowExpressionBody) {
|
||||
this.initFunction(node)
|
||||
if (this.options.ecmaVersion >= 6)
|
||||
node.generator = this.eat(tt.star)
|
||||
if (isStatement || this.type === tt.name)
|
||||
node.id = this.parseIdent()
|
||||
this.parseFunctionParams(node)
|
||||
this.parseFunctionBody(node, allowExpressionBody)
|
||||
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
|
||||
}
|
||||
|
||||
pp.parseFunctionParams = function(node) {
|
||||
this.expect(tt.parenL)
|
||||
node.params = this.parseBindingList(tt.parenR, false, false)
|
||||
}
|
||||
|
||||
// Parse a class declaration or literal (depending on the
|
||||
// `isStatement` parameter).
|
||||
|
||||
pp.parseClass = function(node, isStatement) {
|
||||
this.next()
|
||||
this.parseClassId(node, isStatement)
|
||||
this.parseClassSuper(node)
|
||||
let classBody = this.startNode()
|
||||
let hadConstructor = false
|
||||
classBody.body = []
|
||||
this.expect(tt.braceL)
|
||||
while (!this.eat(tt.braceR)) {
|
||||
if (this.eat(tt.semi)) continue
|
||||
let method = this.startNode()
|
||||
let isGenerator = this.eat(tt.star)
|
||||
let isMaybeStatic = this.type === tt.name && this.value === "static"
|
||||
this.parsePropertyName(method)
|
||||
method.static = isMaybeStatic && this.type !== tt.parenL
|
||||
if (method.static) {
|
||||
if (isGenerator) this.unexpected()
|
||||
isGenerator = this.eat(tt.star)
|
||||
this.parsePropertyName(method)
|
||||
}
|
||||
method.kind = "method"
|
||||
if (!method.computed) {
|
||||
let {key} = method
|
||||
let isGetSet = false
|
||||
if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) {
|
||||
isGetSet = true
|
||||
method.kind = key.name
|
||||
key = this.parsePropertyName(method)
|
||||
}
|
||||
if (!method.static && (key.type === "Identifier" && key.name === "constructor" ||
|
||||
key.type === "Literal" && key.value === "constructor")) {
|
||||
if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class")
|
||||
if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier")
|
||||
if (isGenerator) this.raise(key.start, "Constructor can't be a generator")
|
||||
method.kind = "constructor"
|
||||
hadConstructor = true
|
||||
}
|
||||
}
|
||||
this.parseClassMethod(classBody, method, isGenerator)
|
||||
}
|
||||
node.body = this.finishNode(classBody, "ClassBody")
|
||||
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
||||
}
|
||||
|
||||
pp.parseClassMethod = function(classBody, method, isGenerator) {
|
||||
method.value = this.parseMethod(isGenerator)
|
||||
classBody.body.push(this.finishNode(method, "MethodDefinition"))
|
||||
}
|
||||
|
||||
pp.parseClassId = function(node, isStatement) {
|
||||
node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null
|
||||
}
|
||||
|
||||
pp.parseClassSuper = function(node) {
|
||||
node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null
|
||||
}
|
||||
|
||||
// Parses module export declaration.
|
||||
|
||||
pp.parseExport = function(node) {
|
||||
this.next()
|
||||
// export * from '...'
|
||||
if (this.eat(tt.star)) {
|
||||
this.expectContextual("from")
|
||||
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ExportAllDeclaration")
|
||||
}
|
||||
if (this.eat(tt._default)) { // export default ...
|
||||
let expr = this.parseMaybeAssign()
|
||||
let needsSemi = true
|
||||
if (expr.type == "FunctionExpression" ||
|
||||
expr.type == "ClassExpression") {
|
||||
needsSemi = false
|
||||
if (expr.id) {
|
||||
expr.type = expr.type == "FunctionExpression"
|
||||
? "FunctionDeclaration"
|
||||
: "ClassDeclaration"
|
||||
}
|
||||
}
|
||||
node.declaration = expr
|
||||
if (needsSemi) this.semicolon()
|
||||
return this.finishNode(node, "ExportDefaultDeclaration")
|
||||
}
|
||||
// export var|const|let|function|class ...
|
||||
if (this.shouldParseExportStatement()) {
|
||||
node.declaration = this.parseStatement(true)
|
||||
node.specifiers = []
|
||||
node.source = null
|
||||
} else { // export { x, y as z } [from '...']
|
||||
node.declaration = null
|
||||
node.specifiers = this.parseExportSpecifiers()
|
||||
if (this.eatContextual("from")) {
|
||||
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
|
||||
} else {
|
||||
node.source = null
|
||||
}
|
||||
this.semicolon()
|
||||
}
|
||||
return this.finishNode(node, "ExportNamedDeclaration")
|
||||
}
|
||||
|
||||
pp.shouldParseExportStatement = function() {
|
||||
return this.type.keyword
|
||||
}
|
||||
|
||||
// Parses a comma-separated list of module exports.
|
||||
|
||||
pp.parseExportSpecifiers = function() {
|
||||
let nodes = [], first = true
|
||||
// export { x, y as z } [from '...']
|
||||
this.expect(tt.braceL)
|
||||
while (!this.eat(tt.braceR)) {
|
||||
if (!first) {
|
||||
this.expect(tt.comma)
|
||||
if (this.afterTrailingComma(tt.braceR)) break
|
||||
} else first = false
|
||||
|
||||
let node = this.startNode()
|
||||
node.local = this.parseIdent(this.type === tt._default)
|
||||
node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local
|
||||
nodes.push(this.finishNode(node, "ExportSpecifier"))
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// Parses import declaration.
|
||||
|
||||
pp.parseImport = function(node) {
|
||||
this.next()
|
||||
// import '...'
|
||||
if (this.type === tt.string) {
|
||||
node.specifiers = empty
|
||||
node.source = this.parseExprAtom()
|
||||
node.kind = ""
|
||||
} else {
|
||||
node.specifiers = this.parseImportSpecifiers()
|
||||
this.expectContextual("from")
|
||||
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
|
||||
}
|
||||
this.semicolon()
|
||||
return this.finishNode(node, "ImportDeclaration")
|
||||
}
|
||||
|
||||
// Parses a comma-separated list of module imports.
|
||||
|
||||
pp.parseImportSpecifiers = function() {
|
||||
let nodes = [], first = true
|
||||
if (this.type === tt.name) {
|
||||
// import defaultObj, { x, y as z } from '...'
|
||||
let node = this.startNode()
|
||||
node.local = this.parseIdent()
|
||||
this.checkLVal(node.local, true)
|
||||
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"))
|
||||
if (!this.eat(tt.comma)) return nodes
|
||||
}
|
||||
if (this.type === tt.star) {
|
||||
let node = this.startNode()
|
||||
this.next()
|
||||
this.expectContextual("as")
|
||||
node.local = this.parseIdent()
|
||||
this.checkLVal(node.local, true)
|
||||
nodes.push(this.finishNode(node, "ImportNamespaceSpecifier"))
|
||||
return nodes
|
||||
}
|
||||
this.expect(tt.braceL)
|
||||
while (!this.eat(tt.braceR)) {
|
||||
if (!first) {
|
||||
this.expect(tt.comma)
|
||||
if (this.afterTrailingComma(tt.braceR)) break
|
||||
} else first = false
|
||||
|
||||
let node = this.startNode()
|
||||
node.imported = this.parseIdent(true)
|
||||
node.local = this.eatContextual("as") ? this.parseIdent() : node.imported
|
||||
this.checkLVal(node.local, true)
|
||||
nodes.push(this.finishNode(node, "ImportSpecifier"))
|
||||
}
|
||||
return nodes
|
||||
}
|
107
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/tokencontext.js
generated
vendored
Normal file
107
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/tokencontext.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// The algorithm used to determine whether a regexp can appear at a
|
||||
// given point in the program is loosely based on sweet.js' approach.
|
||||
// See https://github.com/mozilla/sweet.js/wiki/design
|
||||
|
||||
import {Parser} from "./state"
|
||||
import {types as tt} from "./tokentype"
|
||||
import {lineBreak} from "./whitespace"
|
||||
|
||||
export class TokContext {
|
||||
constructor(token, isExpr, preserveSpace, override) {
|
||||
this.token = token
|
||||
this.isExpr = isExpr
|
||||
this.preserveSpace = preserveSpace
|
||||
this.override = override
|
||||
}
|
||||
}
|
||||
|
||||
export const types = {
|
||||
b_stat: new TokContext("{", false),
|
||||
b_expr: new TokContext("{", true),
|
||||
b_tmpl: new TokContext("${", true),
|
||||
p_stat: new TokContext("(", false),
|
||||
p_expr: new TokContext("(", true),
|
||||
q_tmpl: new TokContext("`", true, true, p => p.readTmplToken()),
|
||||
f_expr: new TokContext("function", true)
|
||||
}
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
pp.initialContext = function() {
|
||||
return [types.b_stat]
|
||||
}
|
||||
|
||||
pp.braceIsBlock = function(prevType) {
|
||||
let parent
|
||||
if (prevType === tt.colon && (parent = this.curContext()).token == "{")
|
||||
return !parent.isExpr
|
||||
if (prevType === tt._return)
|
||||
return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
||||
if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof)
|
||||
return true
|
||||
if (prevType == tt.braceL)
|
||||
return this.curContext() === types.b_stat
|
||||
return !this.exprAllowed
|
||||
}
|
||||
|
||||
pp.updateContext = function(prevType) {
|
||||
let update, type = this.type
|
||||
if (type.keyword && prevType == tt.dot)
|
||||
this.exprAllowed = false
|
||||
else if (update = type.updateContext)
|
||||
update.call(this, prevType)
|
||||
else
|
||||
this.exprAllowed = type.beforeExpr
|
||||
}
|
||||
|
||||
// Token-specific context update code
|
||||
|
||||
tt.parenR.updateContext = tt.braceR.updateContext = function() {
|
||||
if (this.context.length == 1) {
|
||||
this.exprAllowed = true
|
||||
return
|
||||
}
|
||||
let out = this.context.pop()
|
||||
if (out === types.b_stat && this.curContext() === types.f_expr) {
|
||||
this.context.pop()
|
||||
this.exprAllowed = false
|
||||
} else if (out === types.b_tmpl) {
|
||||
this.exprAllowed = true
|
||||
} else {
|
||||
this.exprAllowed = !out.isExpr
|
||||
}
|
||||
}
|
||||
|
||||
tt.braceL.updateContext = function(prevType) {
|
||||
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)
|
||||
this.exprAllowed = true
|
||||
}
|
||||
|
||||
tt.dollarBraceL.updateContext = function() {
|
||||
this.context.push(types.b_tmpl)
|
||||
this.exprAllowed = true
|
||||
}
|
||||
|
||||
tt.parenL.updateContext = function(prevType) {
|
||||
let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while
|
||||
this.context.push(statementParens ? types.p_stat : types.p_expr)
|
||||
this.exprAllowed = true
|
||||
}
|
||||
|
||||
tt.incDec.updateContext = function() {
|
||||
// tokExprAllowed stays unchanged
|
||||
}
|
||||
|
||||
tt._function.updateContext = function() {
|
||||
if (this.curContext() !== types.b_stat)
|
||||
this.context.push(types.f_expr)
|
||||
this.exprAllowed = false
|
||||
}
|
||||
|
||||
tt.backQuote.updateContext = function() {
|
||||
if (this.curContext() === types.q_tmpl)
|
||||
this.context.pop()
|
||||
else
|
||||
this.context.push(types.q_tmpl)
|
||||
this.exprAllowed = false
|
||||
}
|
672
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/tokenize.js
generated
vendored
Normal file
672
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/tokenize.js
generated
vendored
Normal file
@@ -0,0 +1,672 @@
|
||||
import {isIdentifierStart, isIdentifierChar} from "./identifier"
|
||||
import {types as tt, keywords as keywordTypes} from "./tokentype"
|
||||
import {Parser} from "./state"
|
||||
import {SourceLocation} from "./location"
|
||||
import {lineBreak, lineBreakG, isNewLine, nonASCIIwhitespace} from "./whitespace"
|
||||
|
||||
// Object type used to represent tokens. Note that normally, tokens
|
||||
// simply exist as properties on the parser object. This is only
|
||||
// used for the onToken callback and the external tokenizer.
|
||||
|
||||
export class Token {
|
||||
constructor(p) {
|
||||
this.type = p.type
|
||||
this.value = p.value
|
||||
this.start = p.start
|
||||
this.end = p.end
|
||||
if (p.options.locations)
|
||||
this.loc = new SourceLocation(p, p.startLoc, p.endLoc)
|
||||
if (p.options.ranges)
|
||||
this.range = [p.start, p.end]
|
||||
}
|
||||
}
|
||||
|
||||
// ## Tokenizer
|
||||
|
||||
const pp = Parser.prototype
|
||||
|
||||
// Are we running under Rhino?
|
||||
const isRhino = typeof Packages !== "undefined"
|
||||
|
||||
// Move to the next token
|
||||
|
||||
pp.next = function() {
|
||||
if (this.options.onToken)
|
||||
this.options.onToken(new Token(this))
|
||||
|
||||
this.lastTokEnd = this.end
|
||||
this.lastTokStart = this.start
|
||||
this.lastTokEndLoc = this.endLoc
|
||||
this.lastTokStartLoc = this.startLoc
|
||||
this.nextToken()
|
||||
}
|
||||
|
||||
pp.getToken = function() {
|
||||
this.next()
|
||||
return new Token(this)
|
||||
}
|
||||
|
||||
// If we're in an ES6 environment, make parsers iterable
|
||||
if (typeof Symbol !== "undefined")
|
||||
pp[Symbol.iterator] = function () {
|
||||
let self = this
|
||||
return {next: function () {
|
||||
let token = self.getToken()
|
||||
return {
|
||||
done: token.type === tt.eof,
|
||||
value: token
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
// Toggle strict mode. Re-reads the next number or string to please
|
||||
// pedantic tests (`"use strict"; 010;` should fail).
|
||||
|
||||
pp.setStrict = function(strict) {
|
||||
this.strict = strict
|
||||
if (this.type !== tt.num && this.type !== tt.string) return
|
||||
this.pos = this.start
|
||||
if (this.options.locations) {
|
||||
while (this.pos < this.lineStart) {
|
||||
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1
|
||||
--this.curLine
|
||||
}
|
||||
}
|
||||
this.nextToken()
|
||||
}
|
||||
|
||||
pp.curContext = function() {
|
||||
return this.context[this.context.length - 1]
|
||||
}
|
||||
|
||||
// Read a single token, updating the parser object's token-related
|
||||
// properties.
|
||||
|
||||
pp.nextToken = function() {
|
||||
let curContext = this.curContext()
|
||||
if (!curContext || !curContext.preserveSpace) this.skipSpace()
|
||||
|
||||
this.start = this.pos
|
||||
if (this.options.locations) this.startLoc = this.curPosition()
|
||||
if (this.pos >= this.input.length) return this.finishToken(tt.eof)
|
||||
|
||||
if (curContext.override) return curContext.override(this)
|
||||
else this.readToken(this.fullCharCodeAtPos())
|
||||
}
|
||||
|
||||
pp.readToken = function(code) {
|
||||
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
||||
// identifiers, so '\' also dispatches to that.
|
||||
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
||||
return this.readWord()
|
||||
|
||||
return this.getTokenFromCode(code)
|
||||
}
|
||||
|
||||
pp.fullCharCodeAtPos = function() {
|
||||
let code = this.input.charCodeAt(this.pos)
|
||||
if (code <= 0xd7ff || code >= 0xe000) return code
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
return (code << 10) + next - 0x35fdc00
|
||||
}
|
||||
|
||||
pp.skipBlockComment = function() {
|
||||
let startLoc = this.options.onComment && this.options.locations && this.curPosition()
|
||||
let start = this.pos, end = this.input.indexOf("*/", this.pos += 2)
|
||||
if (end === -1) this.raise(this.pos - 2, "Unterminated comment")
|
||||
this.pos = end + 2
|
||||
if (this.options.locations) {
|
||||
lineBreakG.lastIndex = start
|
||||
let match
|
||||
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
|
||||
++this.curLine
|
||||
this.lineStart = match.index + match[0].length
|
||||
}
|
||||
}
|
||||
if (this.options.onComment)
|
||||
this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
|
||||
startLoc, this.options.locations && this.curPosition())
|
||||
}
|
||||
|
||||
pp.skipLineComment = function(startSkip) {
|
||||
let start = this.pos
|
||||
let startLoc = this.options.onComment && this.options.locations && this.curPosition()
|
||||
let ch = this.input.charCodeAt(this.pos+=startSkip)
|
||||
while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
|
||||
++this.pos
|
||||
ch = this.input.charCodeAt(this.pos)
|
||||
}
|
||||
if (this.options.onComment)
|
||||
this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
|
||||
startLoc, this.options.locations && this.curPosition())
|
||||
}
|
||||
|
||||
// Called at the start of the parse and after every token. Skips
|
||||
// whitespace and comments, and.
|
||||
|
||||
pp.skipSpace = function() {
|
||||
while (this.pos < this.input.length) {
|
||||
let ch = this.input.charCodeAt(this.pos)
|
||||
if (ch === 32) { // ' '
|
||||
++this.pos
|
||||
} else if (ch === 13) {
|
||||
++this.pos
|
||||
let next = this.input.charCodeAt(this.pos)
|
||||
if (next === 10) {
|
||||
++this.pos
|
||||
}
|
||||
if (this.options.locations) {
|
||||
++this.curLine
|
||||
this.lineStart = this.pos
|
||||
}
|
||||
} else if (ch === 10 || ch === 8232 || ch === 8233) {
|
||||
++this.pos
|
||||
if (this.options.locations) {
|
||||
++this.curLine
|
||||
this.lineStart = this.pos
|
||||
}
|
||||
} else if (ch > 8 && ch < 14) {
|
||||
++this.pos
|
||||
} else if (ch === 47) { // '/'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === 42) { // '*'
|
||||
this.skipBlockComment()
|
||||
} else if (next === 47) { // '/'
|
||||
this.skipLineComment(2)
|
||||
} else break
|
||||
} else if (ch === 160) { // '\xa0'
|
||||
++this.pos
|
||||
} else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
|
||||
++this.pos
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called at the end of every token. Sets `end`, `val`, and
|
||||
// maintains `context` and `exprAllowed`, and skips the space after
|
||||
// the token, so that the next one's `start` will point at the
|
||||
// right position.
|
||||
|
||||
pp.finishToken = function(type, val) {
|
||||
this.end = this.pos
|
||||
if (this.options.locations) this.endLoc = this.curPosition()
|
||||
let prevType = this.type
|
||||
this.type = type
|
||||
this.value = val
|
||||
|
||||
this.updateContext(prevType)
|
||||
}
|
||||
|
||||
// ### Token reading
|
||||
|
||||
// This is the function that is called to fetch the next token. It
|
||||
// is somewhat obscure, because it works in character codes rather
|
||||
// than characters, and because operator parsing has been inlined
|
||||
// into it.
|
||||
//
|
||||
// All in the name of speed.
|
||||
//
|
||||
pp.readToken_dot = function() {
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next >= 48 && next <= 57) return this.readNumber(true)
|
||||
let next2 = this.input.charCodeAt(this.pos + 2)
|
||||
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
||||
this.pos += 3
|
||||
return this.finishToken(tt.ellipsis)
|
||||
} else {
|
||||
++this.pos
|
||||
return this.finishToken(tt.dot)
|
||||
}
|
||||
}
|
||||
|
||||
pp.readToken_slash = function() { // '/'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (this.exprAllowed) {++this.pos; return this.readRegexp();}
|
||||
if (next === 61) return this.finishOp(tt.assign, 2)
|
||||
return this.finishOp(tt.slash, 1)
|
||||
}
|
||||
|
||||
pp.readToken_mult_modulo = function(code) { // '%*'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === 61) return this.finishOp(tt.assign, 2)
|
||||
return this.finishOp(code === 42 ? tt.star : tt.modulo, 1)
|
||||
}
|
||||
|
||||
pp.readToken_pipe_amp = function(code) { // '|&'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2)
|
||||
if (next === 61) return this.finishOp(tt.assign, 2)
|
||||
return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1)
|
||||
}
|
||||
|
||||
pp.readToken_caret = function() { // '^'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === 61) return this.finishOp(tt.assign, 2)
|
||||
return this.finishOp(tt.bitwiseXOR, 1)
|
||||
}
|
||||
|
||||
pp.readToken_plus_min = function(code) { // '+-'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === code) {
|
||||
if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 &&
|
||||
lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) {
|
||||
// A `-->` line comment
|
||||
this.skipLineComment(3)
|
||||
this.skipSpace()
|
||||
return this.nextToken()
|
||||
}
|
||||
return this.finishOp(tt.incDec, 2)
|
||||
}
|
||||
if (next === 61) return this.finishOp(tt.assign, 2)
|
||||
return this.finishOp(tt.plusMin, 1)
|
||||
}
|
||||
|
||||
pp.readToken_lt_gt = function(code) { // '<>'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
let size = 1
|
||||
if (next === code) {
|
||||
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2
|
||||
if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)
|
||||
return this.finishOp(tt.bitShift, size)
|
||||
}
|
||||
if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 &&
|
||||
this.input.charCodeAt(this.pos + 3) == 45) {
|
||||
if (this.inModule) this.unexpected()
|
||||
// `<!--`, an XML-style comment that should be interpreted as a line comment
|
||||
this.skipLineComment(4)
|
||||
this.skipSpace()
|
||||
return this.nextToken()
|
||||
}
|
||||
if (next === 61)
|
||||
size = this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2
|
||||
return this.finishOp(tt.relational, size)
|
||||
}
|
||||
|
||||
pp.readToken_eq_excl = function(code) { // '=!'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === 61) return this.finishOp(tt.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2)
|
||||
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
||||
this.pos += 2
|
||||
return this.finishToken(tt.arrow)
|
||||
}
|
||||
return this.finishOp(code === 61 ? tt.eq : tt.prefix, 1)
|
||||
}
|
||||
|
||||
pp.getTokenFromCode = function(code) {
|
||||
switch (code) {
|
||||
// The interpretation of a dot depends on whether it is followed
|
||||
// by a digit or another two dots.
|
||||
case 46: // '.'
|
||||
return this.readToken_dot()
|
||||
|
||||
// Punctuation tokens.
|
||||
case 40: ++this.pos; return this.finishToken(tt.parenL)
|
||||
case 41: ++this.pos; return this.finishToken(tt.parenR)
|
||||
case 59: ++this.pos; return this.finishToken(tt.semi)
|
||||
case 44: ++this.pos; return this.finishToken(tt.comma)
|
||||
case 91: ++this.pos; return this.finishToken(tt.bracketL)
|
||||
case 93: ++this.pos; return this.finishToken(tt.bracketR)
|
||||
case 123: ++this.pos; return this.finishToken(tt.braceL)
|
||||
case 125: ++this.pos; return this.finishToken(tt.braceR)
|
||||
case 58: ++this.pos; return this.finishToken(tt.colon)
|
||||
case 63: ++this.pos; return this.finishToken(tt.question)
|
||||
|
||||
case 96: // '`'
|
||||
if (this.options.ecmaVersion < 6) break
|
||||
++this.pos
|
||||
return this.finishToken(tt.backQuote)
|
||||
|
||||
case 48: // '0'
|
||||
let next = this.input.charCodeAt(this.pos + 1)
|
||||
if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
|
||||
if (this.options.ecmaVersion >= 6) {
|
||||
if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
|
||||
if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
|
||||
}
|
||||
// Anything else beginning with a digit is an integer, octal
|
||||
// number, or float.
|
||||
case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9
|
||||
return this.readNumber(false)
|
||||
|
||||
// Quotes produce strings.
|
||||
case 34: case 39: // '"', "'"
|
||||
return this.readString(code)
|
||||
|
||||
// Operators are parsed inline in tiny state machines. '=' (61) is
|
||||
// often referred to. `finishOp` simply skips the amount of
|
||||
// characters it is given as second argument, and returns a token
|
||||
// of the type given by its first argument.
|
||||
|
||||
case 47: // '/'
|
||||
return this.readToken_slash()
|
||||
|
||||
case 37: case 42: // '%*'
|
||||
return this.readToken_mult_modulo(code)
|
||||
|
||||
case 124: case 38: // '|&'
|
||||
return this.readToken_pipe_amp(code)
|
||||
|
||||
case 94: // '^'
|
||||
return this.readToken_caret()
|
||||
|
||||
case 43: case 45: // '+-'
|
||||
return this.readToken_plus_min(code)
|
||||
|
||||
case 60: case 62: // '<>'
|
||||
return this.readToken_lt_gt(code)
|
||||
|
||||
case 61: case 33: // '=!'
|
||||
return this.readToken_eq_excl(code)
|
||||
|
||||
case 126: // '~'
|
||||
return this.finishOp(tt.prefix, 1)
|
||||
}
|
||||
|
||||
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'")
|
||||
}
|
||||
|
||||
pp.finishOp = function(type, size) {
|
||||
let str = this.input.slice(this.pos, this.pos + size)
|
||||
this.pos += size
|
||||
return this.finishToken(type, str)
|
||||
}
|
||||
|
||||
var regexpUnicodeSupport = false
|
||||
try { new RegExp("\uffff", "u"); regexpUnicodeSupport = true }
|
||||
catch(e) {}
|
||||
|
||||
// Parse a regular expression. Some context-awareness is necessary,
|
||||
// since a '/' inside a '[]' set does not end the expression.
|
||||
|
||||
pp.readRegexp = function() {
|
||||
let escaped, inClass, start = this.pos
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length) this.raise(start, "Unterminated regular expression")
|
||||
let ch = this.input.charAt(this.pos)
|
||||
if (lineBreak.test(ch)) this.raise(start, "Unterminated regular expression")
|
||||
if (!escaped) {
|
||||
if (ch === "[") inClass = true
|
||||
else if (ch === "]" && inClass) inClass = false
|
||||
else if (ch === "/" && !inClass) break
|
||||
escaped = ch === "\\"
|
||||
} else escaped = false
|
||||
++this.pos
|
||||
}
|
||||
let content = this.input.slice(start, this.pos)
|
||||
++this.pos
|
||||
// Need to use `readWord1` because '\uXXXX' sequences are allowed
|
||||
// here (don't ask).
|
||||
let mods = this.readWord1()
|
||||
let tmp = content
|
||||
if (mods) {
|
||||
let validFlags = /^[gmsiy]*$/
|
||||
if (this.options.ecmaVersion >= 6) validFlags = /^[gmsiyu]*$/
|
||||
if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag")
|
||||
if (mods.indexOf('u') >= 0 && !regexpUnicodeSupport) {
|
||||
// Replace each astral symbol and every Unicode escape sequence that
|
||||
// possibly represents an astral symbol or a paired surrogate with a
|
||||
// single ASCII symbol to avoid throwing on regular expressions that
|
||||
// are only valid in combination with the `/u` flag.
|
||||
// Note: replacing with the ASCII symbol `x` might cause false
|
||||
// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
|
||||
// perfectly valid pattern that is equivalent to `[a-b]`, but it would
|
||||
// be replaced by `[x-b]` which throws an error.
|
||||
tmp = tmp.replace(/\\u([a-fA-F0-9]{4})|\\u\{([0-9a-fA-F]+)\}|[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x")
|
||||
}
|
||||
}
|
||||
// Detect invalid regular expressions.
|
||||
let value = null
|
||||
// Rhino's regular expression parser is flaky and throws uncatchable exceptions,
|
||||
// so don't do detection if we are running under Rhino
|
||||
if (!isRhino) {
|
||||
try {
|
||||
new RegExp(tmp)
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) this.raise(start, "Error parsing regular expression: " + e.message)
|
||||
this.raise(e)
|
||||
}
|
||||
// Get a regular expression object for this pattern-flag pair, or `null` in
|
||||
// case the current environment doesn't support the flags it uses.
|
||||
try {
|
||||
value = new RegExp(content, mods)
|
||||
} catch (err) {}
|
||||
}
|
||||
return this.finishToken(tt.regexp, {pattern: content, flags: mods, value: value})
|
||||
}
|
||||
|
||||
// Read an integer in the given radix. Return null if zero digits
|
||||
// were read, the integer value otherwise. When `len` is given, this
|
||||
// will return `null` unless the integer has exactly `len` digits.
|
||||
|
||||
pp.readInt = function(radix, len) {
|
||||
let start = this.pos, total = 0
|
||||
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
||||
let code = this.input.charCodeAt(this.pos), val
|
||||
if (code >= 97) val = code - 97 + 10; // a
|
||||
else if (code >= 65) val = code - 65 + 10; // A
|
||||
else if (code >= 48 && code <= 57) val = code - 48; // 0-9
|
||||
else val = Infinity
|
||||
if (val >= radix) break
|
||||
++this.pos
|
||||
total = total * radix + val
|
||||
}
|
||||
if (this.pos === start || len != null && this.pos - start !== len) return null
|
||||
|
||||
return total
|
||||
}
|
||||
|
||||
pp.readRadixNumber = function(radix) {
|
||||
this.pos += 2; // 0x
|
||||
let val = this.readInt(radix)
|
||||
if (val == null) this.raise(this.start + 2, "Expected number in radix " + radix)
|
||||
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")
|
||||
return this.finishToken(tt.num, val)
|
||||
}
|
||||
|
||||
// Read an integer, octal integer, or floating-point number.
|
||||
|
||||
pp.readNumber = function(startsWithDot) {
|
||||
let start = this.pos, isFloat = false, octal = this.input.charCodeAt(this.pos) === 48
|
||||
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number")
|
||||
if (this.input.charCodeAt(this.pos) === 46) {
|
||||
++this.pos
|
||||
this.readInt(10)
|
||||
isFloat = true
|
||||
}
|
||||
let next = this.input.charCodeAt(this.pos)
|
||||
if (next === 69 || next === 101) { // 'eE'
|
||||
next = this.input.charCodeAt(++this.pos)
|
||||
if (next === 43 || next === 45) ++this.pos; // '+-'
|
||||
if (this.readInt(10) === null) this.raise(start, "Invalid number")
|
||||
isFloat = true
|
||||
}
|
||||
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.pos, "Identifier directly after number")
|
||||
|
||||
let str = this.input.slice(start, this.pos), val
|
||||
if (isFloat) val = parseFloat(str)
|
||||
else if (!octal || str.length === 1) val = parseInt(str, 10)
|
||||
else if (/[89]/.test(str) || this.strict) this.raise(start, "Invalid number")
|
||||
else val = parseInt(str, 8)
|
||||
return this.finishToken(tt.num, val)
|
||||
}
|
||||
|
||||
// Read a string value, interpreting backslash-escapes.
|
||||
|
||||
pp.readCodePoint = function() {
|
||||
let ch = this.input.charCodeAt(this.pos), code
|
||||
|
||||
if (ch === 123) {
|
||||
if (this.options.ecmaVersion < 6) this.unexpected()
|
||||
++this.pos
|
||||
code = this.readHexChar(this.input.indexOf('}', this.pos) - this.pos)
|
||||
++this.pos
|
||||
if (code > 0x10FFFF) this.unexpected()
|
||||
} else {
|
||||
code = this.readHexChar(4)
|
||||
}
|
||||
return code
|
||||
}
|
||||
|
||||
function codePointToString(code) {
|
||||
// UTF-16 Decoding
|
||||
if (code <= 0xFFFF) return String.fromCharCode(code)
|
||||
return String.fromCharCode(((code - 0x10000) >> 10) + 0xD800,
|
||||
((code - 0x10000) & 1023) + 0xDC00)
|
||||
}
|
||||
|
||||
pp.readString = function(quote) {
|
||||
let out = "", chunkStart = ++this.pos
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant")
|
||||
let ch = this.input.charCodeAt(this.pos)
|
||||
if (ch === quote) break
|
||||
if (ch === 92) { // '\'
|
||||
out += this.input.slice(chunkStart, this.pos)
|
||||
out += this.readEscapedChar()
|
||||
chunkStart = this.pos
|
||||
} else {
|
||||
if (isNewLine(ch)) this.raise(this.start, "Unterminated string constant")
|
||||
++this.pos
|
||||
}
|
||||
}
|
||||
out += this.input.slice(chunkStart, this.pos++)
|
||||
return this.finishToken(tt.string, out)
|
||||
}
|
||||
|
||||
// Reads template string tokens.
|
||||
|
||||
pp.readTmplToken = function() {
|
||||
let out = "", chunkStart = this.pos
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length) this.raise(this.start, "Unterminated template")
|
||||
let ch = this.input.charCodeAt(this.pos)
|
||||
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
||||
if (this.pos === this.start && this.type === tt.template) {
|
||||
if (ch === 36) {
|
||||
this.pos += 2
|
||||
return this.finishToken(tt.dollarBraceL)
|
||||
} else {
|
||||
++this.pos
|
||||
return this.finishToken(tt.backQuote)
|
||||
}
|
||||
}
|
||||
out += this.input.slice(chunkStart, this.pos)
|
||||
return this.finishToken(tt.template, out)
|
||||
}
|
||||
if (ch === 92) { // '\'
|
||||
out += this.input.slice(chunkStart, this.pos)
|
||||
out += this.readEscapedChar()
|
||||
chunkStart = this.pos
|
||||
} else if (isNewLine(ch)) {
|
||||
out += this.input.slice(chunkStart, this.pos)
|
||||
++this.pos
|
||||
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
|
||||
++this.pos
|
||||
out += "\n"
|
||||
} else {
|
||||
out += String.fromCharCode(ch)
|
||||
}
|
||||
if (this.options.locations) {
|
||||
++this.curLine
|
||||
this.lineStart = this.pos
|
||||
}
|
||||
chunkStart = this.pos
|
||||
} else {
|
||||
++this.pos
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Used to read escaped characters
|
||||
|
||||
pp.readEscapedChar = function() {
|
||||
let ch = this.input.charCodeAt(++this.pos)
|
||||
let octal = /^[0-7]+/.exec(this.input.slice(this.pos, this.pos + 3))
|
||||
if (octal) octal = octal[0]
|
||||
while (octal && parseInt(octal, 8) > 255) octal = octal.slice(0, -1)
|
||||
if (octal === "0") octal = null
|
||||
++this.pos
|
||||
if (octal) {
|
||||
if (this.strict) this.raise(this.pos - 2, "Octal literal in strict mode")
|
||||
this.pos += octal.length - 1
|
||||
return String.fromCharCode(parseInt(octal, 8))
|
||||
} else {
|
||||
switch (ch) {
|
||||
case 110: return "\n"; // 'n' -> '\n'
|
||||
case 114: return "\r"; // 'r' -> '\r'
|
||||
case 120: return String.fromCharCode(this.readHexChar(2)); // 'x'
|
||||
case 117: return codePointToString(this.readCodePoint()); // 'u'
|
||||
case 116: return "\t"; // 't' -> '\t'
|
||||
case 98: return "\b"; // 'b' -> '\b'
|
||||
case 118: return "\u000b"; // 'v' -> '\u000b'
|
||||
case 102: return "\f"; // 'f' -> '\f'
|
||||
case 48: return "\0"; // 0 -> '\0'
|
||||
case 13: if (this.input.charCodeAt(this.pos) === 10) ++this.pos; // '\r\n'
|
||||
case 10: // ' \n'
|
||||
if (this.options.locations) { this.lineStart = this.pos; ++this.curLine }
|
||||
return ""
|
||||
default: return String.fromCharCode(ch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Used to read character escape sequences ('\x', '\u', '\U').
|
||||
|
||||
pp.readHexChar = function(len) {
|
||||
let n = this.readInt(16, len)
|
||||
if (n === null) this.raise(this.start, "Bad character escape sequence")
|
||||
return n
|
||||
}
|
||||
|
||||
// Used to signal to callers of `readWord1` whether the word
|
||||
// contained any escape sequences. This is needed because words with
|
||||
// escape sequences must not be interpreted as keywords.
|
||||
|
||||
var containsEsc
|
||||
|
||||
// Read an identifier, and return it as a string. Sets `containsEsc`
|
||||
// to whether the word contained a '\u' escape.
|
||||
//
|
||||
// Incrementally adds only escaped chars, adding other chunks as-is
|
||||
// as a micro-optimization.
|
||||
|
||||
pp.readWord1 = function() {
|
||||
containsEsc = false
|
||||
let word = "", first = true, chunkStart = this.pos
|
||||
let astral = this.options.ecmaVersion >= 6
|
||||
while (this.pos < this.input.length) {
|
||||
let ch = this.fullCharCodeAtPos()
|
||||
if (isIdentifierChar(ch, astral)) {
|
||||
this.pos += ch <= 0xffff ? 1 : 2
|
||||
} else if (ch === 92) { // "\"
|
||||
containsEsc = true
|
||||
word += this.input.slice(chunkStart, this.pos)
|
||||
let escStart = this.pos
|
||||
if (this.input.charCodeAt(++this.pos) != 117) // "u"
|
||||
this.raise(this.pos, "Expecting Unicode escape sequence \\uXXXX")
|
||||
++this.pos
|
||||
let esc = this.readCodePoint()
|
||||
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
||||
this.raise(escStart, "Invalid Unicode escape")
|
||||
word += codePointToString(esc)
|
||||
chunkStart = this.pos
|
||||
} else {
|
||||
break
|
||||
}
|
||||
first = false
|
||||
}
|
||||
return word + this.input.slice(chunkStart, this.pos)
|
||||
}
|
||||
|
||||
// Read an identifier or keyword token. Will check for reserved
|
||||
// words when necessary.
|
||||
|
||||
pp.readWord = function() {
|
||||
let word = this.readWord1()
|
||||
let type = tt.name
|
||||
if ((this.options.ecmaVersion >= 6 || !containsEsc) && this.isKeyword(word))
|
||||
type = keywordTypes[word]
|
||||
return this.finishToken(type, word)
|
||||
}
|
142
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/tokentype.js
generated
vendored
Normal file
142
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/tokentype.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
// ## Token types
|
||||
|
||||
// The assignment of fine-grained, information-carrying type objects
|
||||
// allows the tokenizer to store the information it has about a
|
||||
// token in a way that is very cheap for the parser to look up.
|
||||
|
||||
// All token type variables start with an underscore, to make them
|
||||
// easy to recognize.
|
||||
|
||||
// The `beforeExpr` property is used to disambiguate between regular
|
||||
// expressions and divisions. It is set on all token types that can
|
||||
// be followed by an expression (thus, a slash after them would be a
|
||||
// regular expression).
|
||||
//
|
||||
// `isLoop` marks a keyword as starting a loop, which is important
|
||||
// to know when parsing a label, in order to allow or disallow
|
||||
// continue jumps to that label.
|
||||
|
||||
export class TokenType {
|
||||
constructor(label, conf = {}) {
|
||||
this.label = label
|
||||
this.keyword = conf.keyword
|
||||
this.beforeExpr = !!conf.beforeExpr
|
||||
this.startsExpr = !!conf.startsExpr
|
||||
this.isLoop = !!conf.isLoop
|
||||
this.isAssign = !!conf.isAssign
|
||||
this.prefix = !!conf.prefix
|
||||
this.postfix = !!conf.postfix
|
||||
this.binop = conf.binop || null
|
||||
this.updateContext = null
|
||||
}
|
||||
}
|
||||
|
||||
function binop(name, prec) {
|
||||
return new TokenType(name, {beforeExpr: true, binop: prec})
|
||||
}
|
||||
const beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}
|
||||
|
||||
export const types = {
|
||||
num: new TokenType("num", startsExpr),
|
||||
regexp: new TokenType("regexp", startsExpr),
|
||||
string: new TokenType("string", startsExpr),
|
||||
name: new TokenType("name", startsExpr),
|
||||
eof: new TokenType("eof"),
|
||||
|
||||
// Punctuation token types.
|
||||
bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
|
||||
bracketR: new TokenType("]"),
|
||||
braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
|
||||
braceR: new TokenType("}"),
|
||||
parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
|
||||
parenR: new TokenType(")"),
|
||||
comma: new TokenType(",", beforeExpr),
|
||||
semi: new TokenType(";", beforeExpr),
|
||||
colon: new TokenType(":", beforeExpr),
|
||||
dot: new TokenType("."),
|
||||
question: new TokenType("?", beforeExpr),
|
||||
arrow: new TokenType("=>", beforeExpr),
|
||||
template: new TokenType("template"),
|
||||
ellipsis: new TokenType("...", beforeExpr),
|
||||
backQuote: new TokenType("`", startsExpr),
|
||||
dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
|
||||
|
||||
// Operators. These carry several kinds of properties to help the
|
||||
// parser use them properly (the presence of these properties is
|
||||
// what categorizes them as operators).
|
||||
//
|
||||
// `binop`, when present, specifies that this operator is a binary
|
||||
// operator, and will refer to its precedence.
|
||||
//
|
||||
// `prefix` and `postfix` mark the operator as a prefix or postfix
|
||||
// unary operator.
|
||||
//
|
||||
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
|
||||
// binary operators with a very low precedence, that should result
|
||||
// in AssignmentExpression nodes.
|
||||
|
||||
eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
|
||||
assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
|
||||
incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
|
||||
prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),
|
||||
logicalOR: binop("||", 1),
|
||||
logicalAND: binop("&&", 2),
|
||||
bitwiseOR: binop("|", 3),
|
||||
bitwiseXOR: binop("^", 4),
|
||||
bitwiseAND: binop("&", 5),
|
||||
equality: binop("==/!=", 6),
|
||||
relational: binop("</>", 7),
|
||||
bitShift: binop("<</>>", 8),
|
||||
plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
|
||||
modulo: binop("%", 10),
|
||||
star: binop("*", 10),
|
||||
slash: binop("/", 10)
|
||||
}
|
||||
|
||||
// Map keyword names to token types.
|
||||
|
||||
export const keywords = {}
|
||||
|
||||
// Succinct definitions of keyword token types
|
||||
function kw(name, options = {}) {
|
||||
options.keyword = name
|
||||
keywords[name] = types["_" + name] = new TokenType(name, options)
|
||||
}
|
||||
|
||||
kw("break")
|
||||
kw("case", beforeExpr)
|
||||
kw("catch")
|
||||
kw("continue")
|
||||
kw("debugger")
|
||||
kw("default")
|
||||
kw("do", {isLoop: true})
|
||||
kw("else", beforeExpr)
|
||||
kw("finally")
|
||||
kw("for", {isLoop: true})
|
||||
kw("function", startsExpr)
|
||||
kw("if")
|
||||
kw("return", beforeExpr)
|
||||
kw("switch")
|
||||
kw("throw", beforeExpr)
|
||||
kw("try")
|
||||
kw("var")
|
||||
kw("let")
|
||||
kw("const")
|
||||
kw("while", {isLoop: true})
|
||||
kw("with")
|
||||
kw("new", {beforeExpr: true, startsExpr: true})
|
||||
kw("this", startsExpr)
|
||||
kw("super", startsExpr)
|
||||
kw("class")
|
||||
kw("extends", beforeExpr)
|
||||
kw("export")
|
||||
kw("import")
|
||||
kw("yield", {beforeExpr: true, startsExpr: true})
|
||||
kw("null", startsExpr)
|
||||
kw("true", startsExpr)
|
||||
kw("false", startsExpr)
|
||||
kw("in", {beforeExpr: true, binop: 7})
|
||||
kw("instanceof", {beforeExpr: true, binop: 7})
|
||||
kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true})
|
||||
kw("void", {beforeExpr: true, prefix: true, startsExpr: true})
|
||||
kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
|
9
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/util.js
generated
vendored
Normal file
9
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/util.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export function isArray(obj) {
|
||||
return Object.prototype.toString.call(obj) === "[object Array]"
|
||||
}
|
||||
|
||||
// Checks if an object has a property.
|
||||
|
||||
export function has(obj, propName) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, propName)
|
||||
}
|
291
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/walk/index.js
generated
vendored
Normal file
291
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/walk/index.js
generated
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression,
|
||||
// Statement, and ScopeBody, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
|
||||
export function simple(node, visitors, base, state) {
|
||||
if (!base) base = exports.base
|
||||
;(function c(node, st, override) {
|
||||
let type = override || node.type, found = visitors[type]
|
||||
base[type](node, st, c)
|
||||
if (found) found(node, st)
|
||||
})(node, state)
|
||||
}
|
||||
|
||||
// An ancestor walk builds up an array of ancestor nodes (including
|
||||
// the current node) and passes them to the callback as the state parameter.
|
||||
export function ancestor(node, visitors, base, state) {
|
||||
if (!base) base = exports.base
|
||||
if (!state) state = []
|
||||
;(function c(node, st, override) {
|
||||
let type = override || node.type, found = visitors[type]
|
||||
if (node != st[st.length - 1]) {
|
||||
st = st.slice()
|
||||
st.push(node)
|
||||
}
|
||||
base[type](node, st, c)
|
||||
if (found) found(node, st)
|
||||
})(node, state)
|
||||
}
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
export function recursive(node, state, funcs, base) {
|
||||
let visitor = funcs ? exports.make(funcs, base) : base
|
||||
;(function c(node, st, override) {
|
||||
visitor[override || node.type](node, st, c)
|
||||
})(node, state)
|
||||
}
|
||||
|
||||
function makeTest(test) {
|
||||
if (typeof test == "string")
|
||||
return type => type == test
|
||||
else if (!test)
|
||||
return () => true
|
||||
else
|
||||
return test
|
||||
}
|
||||
|
||||
class Found {
|
||||
constructor(node, state) { this.node = node; this.state = state }
|
||||
}
|
||||
|
||||
// Find a node with a given start, end, and type (all are optional,
|
||||
// null can be used as wildcard). Returns a {node, state} object, or
|
||||
// undefined when it doesn't find a matching node.
|
||||
export function findNodeAt(node, start, end, test, base, state) {
|
||||
test = makeTest(test)
|
||||
if (!base) base = exports.base
|
||||
try {
|
||||
;(function c(node, st, override) {
|
||||
let type = override || node.type
|
||||
if ((start == null || node.start <= start) &&
|
||||
(end == null || node.end >= end))
|
||||
base[type](node, st, c)
|
||||
if (test(type, node) &&
|
||||
(start == null || node.start == start) &&
|
||||
(end == null || node.end == end))
|
||||
throw new Found(node, st)
|
||||
})(node, state)
|
||||
} catch (e) {
|
||||
if (e instanceof Found) return e
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the innermost node of a given type that contains the given
|
||||
// position. Interface similar to findNodeAt.
|
||||
export function findNodeAround(node, pos, test, base, state) {
|
||||
test = makeTest(test)
|
||||
if (!base) base = exports.base
|
||||
try {
|
||||
;(function c(node, st, override) {
|
||||
let type = override || node.type
|
||||
if (node.start > pos || node.end < pos) return
|
||||
base[type](node, st, c)
|
||||
if (test(type, node)) throw new Found(node, st)
|
||||
})(node, state)
|
||||
} catch (e) {
|
||||
if (e instanceof Found) return e
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node after a given position.
|
||||
export function findNodeAfter(node, pos, test, base, state) {
|
||||
test = makeTest(test)
|
||||
if (!base) base = exports.base
|
||||
try {
|
||||
;(function c(node, st, override) {
|
||||
if (node.end < pos) return
|
||||
let type = override || node.type
|
||||
if (node.start >= pos && test(type, node)) throw new Found(node, st)
|
||||
base[type](node, st, c)
|
||||
})(node, state)
|
||||
} catch (e) {
|
||||
if (e instanceof Found) return e
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node before a given position.
|
||||
export function findNodeBefore(node, pos, test, base, state) {
|
||||
test = makeTest(test)
|
||||
if (!base) base = exports.base
|
||||
let max
|
||||
;(function c(node, st, override) {
|
||||
if (node.start > pos) return
|
||||
let type = override || node.type
|
||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
||||
max = new Found(node, st)
|
||||
base[type](node, st, c)
|
||||
})(node, state)
|
||||
return max
|
||||
}
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
export function make(funcs, base) {
|
||||
if (!base) base = exports.base
|
||||
let visitor = {}
|
||||
for (var type in base) visitor[type] = base[type]
|
||||
for (var type in funcs) visitor[type] = funcs[type]
|
||||
return visitor
|
||||
}
|
||||
|
||||
function skipThrough(node, st, c) { c(node, st) }
|
||||
function ignore(_node, _st, _c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
export const base = {}
|
||||
|
||||
base.Program = base.BlockStatement = (node, st, c) => {
|
||||
for (let i = 0; i < node.body.length; ++i)
|
||||
c(node.body[i], st, "Statement")
|
||||
}
|
||||
base.Statement = skipThrough
|
||||
base.EmptyStatement = ignore
|
||||
base.ExpressionStatement = base.ParenthesizedExpression =
|
||||
(node, st, c) => c(node.expression, st, "Expression")
|
||||
base.IfStatement = (node, st, c) => {
|
||||
c(node.test, st, "Expression")
|
||||
c(node.consequent, st, "Statement")
|
||||
if (node.alternate) c(node.alternate, st, "Statement")
|
||||
}
|
||||
base.LabeledStatement = (node, st, c) => c(node.body, st, "Statement")
|
||||
base.BreakStatement = base.ContinueStatement = ignore
|
||||
base.WithStatement = (node, st, c) => {
|
||||
c(node.object, st, "Expression")
|
||||
c(node.body, st, "Statement")
|
||||
}
|
||||
base.SwitchStatement = (node, st, c) => {
|
||||
c(node.discriminant, st, "Expression")
|
||||
for (let i = 0; i < node.cases.length; ++i) {
|
||||
let cs = node.cases[i]
|
||||
if (cs.test) c(cs.test, st, "Expression")
|
||||
for (let j = 0; j < cs.consequent.length; ++j)
|
||||
c(cs.consequent[j], st, "Statement")
|
||||
}
|
||||
}
|
||||
base.ReturnStatement = base.YieldExpression = (node, st, c) => {
|
||||
if (node.argument) c(node.argument, st, "Expression")
|
||||
}
|
||||
base.ThrowStatement = base.SpreadElement = base.RestElement =
|
||||
(node, st, c) => c(node.argument, st, "Expression")
|
||||
base.TryStatement = (node, st, c) => {
|
||||
c(node.block, st, "Statement")
|
||||
if (node.handler) c(node.handler.body, st, "ScopeBody")
|
||||
if (node.finalizer) c(node.finalizer, st, "Statement")
|
||||
}
|
||||
base.WhileStatement = base.DoWhileStatement = (node, st, c) => {
|
||||
c(node.test, st, "Expression")
|
||||
c(node.body, st, "Statement")
|
||||
}
|
||||
base.ForStatement = (node, st, c) => {
|
||||
if (node.init) c(node.init, st, "ForInit")
|
||||
if (node.test) c(node.test, st, "Expression")
|
||||
if (node.update) c(node.update, st, "Expression")
|
||||
c(node.body, st, "Statement")
|
||||
}
|
||||
base.ForInStatement = base.ForOfStatement = (node, st, c) => {
|
||||
c(node.left, st, "ForInit")
|
||||
c(node.right, st, "Expression")
|
||||
c(node.body, st, "Statement")
|
||||
}
|
||||
base.ForInit = (node, st, c) => {
|
||||
if (node.type == "VariableDeclaration") c(node, st)
|
||||
else c(node, st, "Expression")
|
||||
}
|
||||
base.DebuggerStatement = ignore
|
||||
|
||||
base.FunctionDeclaration = (node, st, c) => c(node, st, "Function")
|
||||
base.VariableDeclaration = (node, st, c) => {
|
||||
for (let i = 0; i < node.declarations.length; ++i) {
|
||||
let decl = node.declarations[i]
|
||||
if (decl.init) c(decl.init, st, "Expression")
|
||||
}
|
||||
}
|
||||
|
||||
base.Function = (node, st, c) => c(node.body, st, "ScopeBody")
|
||||
base.ScopeBody = (node, st, c) => c(node, st, "Statement")
|
||||
|
||||
base.Expression = skipThrough
|
||||
base.ThisExpression = base.Super = base.MetaProperty = ignore
|
||||
base.ArrayExpression = base.ArrayPattern = (node, st, c) => {
|
||||
for (let i = 0; i < node.elements.length; ++i) {
|
||||
let elt = node.elements[i]
|
||||
if (elt) c(elt, st, "Expression")
|
||||
}
|
||||
}
|
||||
base.ObjectExpression = base.ObjectPattern = (node, st, c) => {
|
||||
for (let i = 0; i < node.properties.length; ++i)
|
||||
c(node.properties[i], st)
|
||||
}
|
||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration
|
||||
base.SequenceExpression = base.TemplateLiteral = (node, st, c) => {
|
||||
for (let i = 0; i < node.expressions.length; ++i)
|
||||
c(node.expressions[i], st, "Expression")
|
||||
}
|
||||
base.UnaryExpression = base.UpdateExpression = (node, st, c) => {
|
||||
c(node.argument, st, "Expression")
|
||||
}
|
||||
base.BinaryExpression = base.AssignmentExpression = base.AssignmentPattern = base.LogicalExpression = (node, st, c) => {
|
||||
c(node.left, st, "Expression")
|
||||
c(node.right, st, "Expression")
|
||||
}
|
||||
base.ConditionalExpression = (node, st, c) => {
|
||||
c(node.test, st, "Expression")
|
||||
c(node.consequent, st, "Expression")
|
||||
c(node.alternate, st, "Expression")
|
||||
}
|
||||
base.NewExpression = base.CallExpression = (node, st, c) => {
|
||||
c(node.callee, st, "Expression")
|
||||
if (node.arguments) for (let i = 0; i < node.arguments.length; ++i)
|
||||
c(node.arguments[i], st, "Expression")
|
||||
}
|
||||
base.MemberExpression = (node, st, c) => {
|
||||
c(node.object, st, "Expression")
|
||||
if (node.computed) c(node.property, st, "Expression")
|
||||
}
|
||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = (node, st, c) => c(node.declaration, st)
|
||||
base.ImportDeclaration = (node, st, c) => {
|
||||
for (let i = 0; i < node.specifiers.length; i++)
|
||||
c(node.specifiers[i], st)
|
||||
}
|
||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore
|
||||
|
||||
base.TaggedTemplateExpression = (node, st, c) => {
|
||||
c(node.tag, st, "Expression")
|
||||
c(node.quasi, st)
|
||||
}
|
||||
base.ClassDeclaration = base.ClassExpression = (node, st, c) => {
|
||||
if (node.superClass) c(node.superClass, st, "Expression")
|
||||
for (let i = 0; i < node.body.body.length; i++)
|
||||
c(node.body.body[i], st)
|
||||
}
|
||||
base.MethodDefinition = base.Property = (node, st, c) => {
|
||||
if (node.computed) c(node.key, st, "Expression")
|
||||
c(node.value, st, "Expression")
|
||||
}
|
||||
base.ComprehensionExpression = (node, st, c) => {
|
||||
for (let i = 0; i < node.blocks.length; i++)
|
||||
c(node.blocks[i].right, st, "Expression")
|
||||
c(node.body, st, "Expression")
|
||||
}
|
12
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/whitespace.js
generated
vendored
Normal file
12
ng2-components/ng2-alfresco-documentslist/dist/node_modules/acorn/src/whitespace.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Matches a whole line break (where CRLF is considered a single
|
||||
// line break). Used to count lines.
|
||||
|
||||
export const lineBreak = /\r\n?|\n|\u2028|\u2029/
|
||||
export const lineBreakG = new RegExp(lineBreak.source, "g")
|
||||
|
||||
export function isNewLine(code) {
|
||||
return code === 10 || code === 13 || code === 0x2028 || code == 0x2029
|
||||
}
|
||||
|
||||
export const nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/
|
||||
|
19
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/LICENCE
generated
vendored
Normal file
19
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/LICENCE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Raynos.
|
||||
|
||||
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.
|
75
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/README.md
generated
vendored
Normal file
75
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/README.md
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# After [![Build Status][1]][2]
|
||||
|
||||
Invoke callback after n calls
|
||||
|
||||
## Status: production ready
|
||||
|
||||
## Example
|
||||
|
||||
var after = require("after")
|
||||
, next = after(3, logItWorks)
|
||||
|
||||
next()
|
||||
next()
|
||||
next() // it works
|
||||
|
||||
function logItWorks() {
|
||||
console.log("it works!")
|
||||
}
|
||||
|
||||
## Example with error handling
|
||||
|
||||
var after = require("after")
|
||||
, next = after(3, logError)
|
||||
|
||||
next()
|
||||
next(new Error("oops")) // logs oops
|
||||
next() // does nothing
|
||||
|
||||
function logError(err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
## After < 0.6.0
|
||||
|
||||
Older versions of after had iterators and flows in them.
|
||||
|
||||
These have been replaced with seperate modules
|
||||
|
||||
- [iterators][8]
|
||||
- [composite][9]
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install after`
|
||||
|
||||
## Tests
|
||||
|
||||
`npm test`
|
||||
|
||||
## Blog post
|
||||
|
||||
- [Flow control in node.js][3]
|
||||
|
||||
## Examples :
|
||||
|
||||
- [Determining the end of asynchronous operations][4]
|
||||
- [In javascript what are best practices for executing multiple asynchronous functions][5]
|
||||
- [JavaScript performance long running tasks][6]
|
||||
- [Synchronous database queries with node.js][7]
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[1]: https://secure.travis-ci.org/Raynos/after.png
|
||||
[2]: http://travis-ci.org/Raynos/after
|
||||
[3]: http://raynos.org/blog/2/Flow-control-in-node.js
|
||||
[4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307
|
||||
[5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031
|
||||
[6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419
|
||||
[7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091
|
||||
[8]: http://github.com/Raynos/iterators
|
||||
[9]: http://github.com/Raynos/composite
|
28
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/index.js
generated
vendored
Normal file
28
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
module.exports = after
|
||||
|
||||
function after(count, callback, err_cb) {
|
||||
var bail = false
|
||||
err_cb = err_cb || noop
|
||||
proxy.count = count
|
||||
|
||||
return (count === 0) ? callback() : proxy
|
||||
|
||||
function proxy(err, result) {
|
||||
if (proxy.count <= 0) {
|
||||
throw new Error('after called too many times')
|
||||
}
|
||||
--proxy.count
|
||||
|
||||
// after first error, rest are passed to err_cb
|
||||
if (err) {
|
||||
bail = true
|
||||
callback(err)
|
||||
// future error callbacks will go to error handler
|
||||
callback = err_cb
|
||||
} else if (proxy.count === 0 && !bail) {
|
||||
callback(null, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function noop() {}
|
88
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/package.json
generated
vendored
Normal file
88
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/package.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"after@0.8.1",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/browser-sync/node_modules/engine.io-parser"
|
||||
]
|
||||
],
|
||||
"_from": "after@0.8.1",
|
||||
"_id": "after@0.8.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/after",
|
||||
"_npmUser": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "raynos"
|
||||
},
|
||||
"_npmVersion": "1.2.25",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "after",
|
||||
"raw": "after@0.8.1",
|
||||
"rawSpec": "0.8.1",
|
||||
"scope": null,
|
||||
"spec": "0.8.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-sync/engine.io-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/after/-/after-0.8.1.tgz",
|
||||
"_shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "after@0.8.1",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/browser-sync/node_modules/engine.io-parser",
|
||||
"author": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "Raynos"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/after/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "Raynos",
|
||||
"url": "http://raynos.org"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "after - tiny flow control",
|
||||
"devDependencies": {
|
||||
"mocha": "~1.8.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627",
|
||||
"tarball": "https://registry.npmjs.org/after/-/after-0.8.1.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/Raynos/after#readme",
|
||||
"keywords": [
|
||||
"flowcontrol",
|
||||
"after",
|
||||
"flow",
|
||||
"control",
|
||||
"arch"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "raynos"
|
||||
},
|
||||
{
|
||||
"email": "shtylman@gmail.com",
|
||||
"name": "shtylman"
|
||||
}
|
||||
],
|
||||
"name": "after",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Raynos/after.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --ui tdd --reporter spec test/*.js"
|
||||
},
|
||||
"version": "0.8.1"
|
||||
}
|
120
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/test/after-test.js
generated
vendored
Normal file
120
ng2-components/ng2-alfresco-documentslist/dist/node_modules/after/test/after-test.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
/*global suite, test*/
|
||||
|
||||
var assert = require("assert")
|
||||
, after = require("../")
|
||||
|
||||
test("exists", function () {
|
||||
assert(typeof after === "function", "after is not a function")
|
||||
})
|
||||
|
||||
test("after when called with 0 invokes", function (done) {
|
||||
after(0, done)
|
||||
});
|
||||
|
||||
test("after 1", function (done) {
|
||||
var next = after(1, done)
|
||||
next()
|
||||
})
|
||||
|
||||
test("after 5", function (done) {
|
||||
var next = after(5, done)
|
||||
, i = 5
|
||||
|
||||
while (i--) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
test("manipulate count", function (done) {
|
||||
var next = after(1, done)
|
||||
, i = 5
|
||||
|
||||
next.count = i
|
||||
while (i--) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
test("after terminates on error", function (done) {
|
||||
var next = after(2, function(err) {
|
||||
assert.equal(err.message, 'test');
|
||||
done();
|
||||
})
|
||||
next(new Error('test'))
|
||||
next(new Error('test2'))
|
||||
})
|
||||
|
||||
test('gee', function(done) {
|
||||
done = after(2, done)
|
||||
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
assert.equal(err.message, 2)
|
||||
done()
|
||||
});
|
||||
|
||||
next()
|
||||
next(new Error(1))
|
||||
next(new Error(2))
|
||||
})
|
||||
|
||||
test('eee', function(done) {
|
||||
done = after(3, done)
|
||||
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
assert.equal(err.message, 2)
|
||||
done()
|
||||
});
|
||||
|
||||
next(new Error(1))
|
||||
next(new Error(2))
|
||||
next(new Error(2))
|
||||
})
|
||||
|
||||
test('gge', function(done) {
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
// should not happen
|
||||
assert.ok(false);
|
||||
});
|
||||
|
||||
next()
|
||||
next()
|
||||
next(new Error(1))
|
||||
})
|
||||
|
||||
test('egg', function(done) {
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
// should not happen
|
||||
assert.ok(false);
|
||||
});
|
||||
|
||||
next(new Error(1))
|
||||
next()
|
||||
next()
|
||||
})
|
||||
|
||||
test('throws on too many calls', function(done) {
|
||||
var next = after(1, done);
|
||||
next()
|
||||
assert.throws(next, /after called too many times/);
|
||||
});
|
||||
|
41
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/History.md
generated
vendored
Normal file
41
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/History.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
2.0.1 / 2015-09-10
|
||||
==================
|
||||
|
||||
* package: update "semver" to v5.0.1 for WebPack (#1, @vhpoet)
|
||||
|
||||
2.0.0 / 2015-07-10
|
||||
==================
|
||||
|
||||
* refactor to patch Node.js core for more consistent `opts` values
|
||||
* ensure that HTTP(s) default port numbers are always given
|
||||
* test: use ssl-cert-snakeoil SSL certs
|
||||
* test: add tests for arbitrary options
|
||||
* README: add API section
|
||||
* README: make the Agent HTTP/HTTPS generic in the example
|
||||
* README: use SVG for Travis-CI badge
|
||||
|
||||
1.0.2 / 2015-06-27
|
||||
==================
|
||||
|
||||
* agent: set `req._hadError` to true after emitting "error"
|
||||
* package: update "mocha" to v2
|
||||
* test: add artificial HTTP GET request test
|
||||
* test: add artificial data events test
|
||||
* test: fix artifical GET response test on node > v0.11.3
|
||||
* test: use a real timeout for the async error test
|
||||
|
||||
1.0.1 / 2013-09-09
|
||||
==================
|
||||
|
||||
* Fix passing an "error" object to the callback function on the first tick
|
||||
|
||||
1.0.0 / 2013-09-09
|
||||
==================
|
||||
|
||||
* New API: now you pass a callback function directly
|
||||
|
||||
0.0.1 / 2013-07-09
|
||||
==================
|
||||
|
||||
* Initial release
|
121
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/README.md
generated
vendored
Normal file
121
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/README.md
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
agent-base
|
||||
==========
|
||||
### Turn a function into an `http.Agent` instance
|
||||
[](https://travis-ci.org/TooTallNate/node-agent-base)
|
||||
|
||||
This module provides an `http.Agent` generator. That is, you pass it an async
|
||||
callback function, and it returns a new `http.Agent` instance that will invoke the
|
||||
given callback function when sending outbound HTTP requests.
|
||||
|
||||
#### Some subclasses:
|
||||
|
||||
Here's some more interesting uses of `agent-base`.
|
||||
Send a pull request to list yours!
|
||||
|
||||
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
||||
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
||||
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
||||
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS (v4a) proxy `http.Agent` implementation for HTTP and HTTPS
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install agent-base
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
Here's a minimal example that creates a new `net.Socket` connection to the server
|
||||
for every HTTP request (i.e. the equivalent of `agent: false` option):
|
||||
|
||||
``` js
|
||||
var net = require('net');
|
||||
var tls = require('tls');
|
||||
var url = require('url');
|
||||
var http = require('http');
|
||||
var agent = require('agent-base');
|
||||
|
||||
var endpoint = 'http://nodejs.org/api/';
|
||||
var opts = url.parse(endpoint);
|
||||
|
||||
// This is the important part!
|
||||
opts.agent = agent(function (req, opts, fn) {
|
||||
var socket;
|
||||
// `secureEndpoint` is true when using the https module
|
||||
if (opts.secureEndpoint) {
|
||||
socket = tls.connect(opts);
|
||||
} else {
|
||||
socket = net.connect(opts);
|
||||
}
|
||||
fn(null, socket);
|
||||
});
|
||||
|
||||
// Everything else works just like normal...
|
||||
http.get(opts, function (res) {
|
||||
console.log('"response" event!', res.headers);
|
||||
res.pipe(process.stdout);
|
||||
});
|
||||
```
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
## Agent(Function callback) → http.Agent
|
||||
|
||||
Creates a base `http.Agent` that will execute the callback function `callback`
|
||||
for every HTTP request that it is used as the `agent` for. The callback function
|
||||
is responsible for creating a `stream.Duplex` instance of some kind that will be
|
||||
used as the underlying socket in the HTTP request.
|
||||
|
||||
The callback function should have the following signature:
|
||||
|
||||
### callback(http.ClientRequest req, Object options, Function cb) → undefined
|
||||
|
||||
The ClientRequest `req` can be accessed to read request headers and
|
||||
and the path, etc. The `options` object contains the options passed
|
||||
to the `http.request()`/`https.request()` function call, and is formatted
|
||||
to be directly passed to `net.connect()`/`tls.connect()`, or however
|
||||
else you want a Socket to be created. Pass the created socket to
|
||||
the callback function `cb` once created, and the HTTP request will
|
||||
continue to proceed.
|
||||
|
||||
If the `https` module is used to invoke the HTTP request, then the
|
||||
`secureEndpoint` property on `options` will be set to `true`.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
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.
|
||||
|
||||
[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
101
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/agent.js
generated
vendored
Normal file
101
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/agent.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
require('./patch-core');
|
||||
var extend = require('extend');
|
||||
var inherits = require('util').inherits;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = Agent;
|
||||
|
||||
/**
|
||||
* Base `http.Agent` implementation.
|
||||
* No pooling/keep-alive is implemented by default.
|
||||
*
|
||||
* @param {Function} callback
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Agent (callback) {
|
||||
if (!(this instanceof Agent)) return new Agent(callback);
|
||||
if ('function' != typeof callback) throw new Error('Must pass a "callback function"');
|
||||
EventEmitter.call(this);
|
||||
this.callback = callback;
|
||||
}
|
||||
inherits(Agent, EventEmitter);
|
||||
|
||||
/**
|
||||
* Called by node-core's "_http_client.js" module when creating
|
||||
* a new HTTP request with this Agent instance.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Agent.prototype.addRequest = function (req, host, port, localAddress) {
|
||||
var opts;
|
||||
if ('object' == typeof host) {
|
||||
// >= v0.11.x API
|
||||
opts = extend({}, req._options, host);
|
||||
} else {
|
||||
// <= v0.10.x API
|
||||
opts = extend({}, req._options, { host: host, port: port });
|
||||
if (null != localAddress) {
|
||||
opts.localAddress = localAddress;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.host && opts.path) {
|
||||
// if both a `host` and `path` are specified then it's most likely the
|
||||
// result of a `url.parse()` call... we need to remove the `path` portion so
|
||||
// that `net.connect()` doesn't attempt to open that as a unix socket file.
|
||||
delete opts.path;
|
||||
}
|
||||
|
||||
// set default `port` if none was explicitly specified
|
||||
if (null == opts.port) {
|
||||
opts.port = opts.secureEndpoint ? 443 : 80;
|
||||
}
|
||||
|
||||
delete opts.agent;
|
||||
delete opts.hostname;
|
||||
delete opts._defaultAgent;
|
||||
delete opts.defaultPort;
|
||||
delete opts.createConnection;
|
||||
|
||||
// hint to use "Connection: close"
|
||||
// XXX: non-documented `http` module API :(
|
||||
req._last = true;
|
||||
req.shouldKeepAlive = false;
|
||||
|
||||
// clean up a bit of memory since we're no longer using this
|
||||
req._options = null;
|
||||
|
||||
// create the `net.Socket` instance
|
||||
var sync = true;
|
||||
this.callback(req, opts, function (err, socket) {
|
||||
function emitErr () {
|
||||
req.emit('error', err);
|
||||
// For Safety. Some additional errors might fire later on
|
||||
// and we need to make sure we don't double-fire the error event.
|
||||
req._hadError = true;
|
||||
}
|
||||
if (err) {
|
||||
if (sync) {
|
||||
// need to defer the "error" event, when sync, because by now the `req`
|
||||
// instance hasn't event been passed back to the user yet...
|
||||
process.nextTick(emitErr);
|
||||
} else {
|
||||
emitErr();
|
||||
}
|
||||
} else {
|
||||
req.onSocket(socket);
|
||||
}
|
||||
});
|
||||
sync = false;
|
||||
};
|
15
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/LICENSE
generated
vendored
Normal file
15
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
303
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/README.md
generated
vendored
Normal file
303
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/README.md
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Usage
|
||||
|
||||
$ npm install semver
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
$ semver -h
|
||||
|
||||
Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | --preid <identifier> | -l | -rv]
|
||||
Test if version(s) satisfy the supplied range(s), and sort them.
|
||||
|
||||
Multiple versions or ranges may be supplied, unless increment
|
||||
option is specified. In that case, only a single version may
|
||||
be used, and it is incremented by the specified level
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no versions are valid, or ranges are not satisfied,
|
||||
then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<http://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
> semver.inc('1.2.3', 'pre', 'beta')
|
||||
'1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```shell
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```shell
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero digit in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `loose` boolean argument that, if
|
||||
true, will be more forgiving about not-quite-valid semver strings.
|
||||
The resulting output will always be 100% strict, of course.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
133
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/bin/semver
generated
vendored
Executable file
133
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/bin/semver
generated
vendored
Executable file
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
, versions = []
|
||||
, range = []
|
||||
, gt = []
|
||||
, lt = []
|
||||
, eq = []
|
||||
, inc = null
|
||||
, version = require("../package.json").version
|
||||
, loose = false
|
||||
, identifier = undefined
|
||||
, semver = require("../semver")
|
||||
, reverse = false
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var i = a.indexOf('=')
|
||||
if (i !== -1) {
|
||||
a = a.slice(0, i)
|
||||
argv.unshift(a.slice(i + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case "-rv": case "-rev": case "--rev": case "--reverse":
|
||||
reverse = true
|
||||
break
|
||||
case "-l": case "--loose":
|
||||
loose = true
|
||||
break
|
||||
case "-v": case "--version":
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case "-i": case "--inc": case "--increment":
|
||||
switch (argv[0]) {
|
||||
case "major": case "minor": case "patch": case "prerelease":
|
||||
case "premajor": case "preminor": case "prepatch":
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = "patch"
|
||||
break
|
||||
}
|
||||
break
|
||||
case "--preid":
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case "-r": case "--range":
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case "-h": case "--help": case "-?":
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.valid(v, loose)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length))
|
||||
return failInc()
|
||||
|
||||
for (var i = 0, l = range.length; i < l ; i ++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], loose)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error("--inc can only be used on a single version with no range")
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? "rcompare" : "compare"
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, loose)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, loose)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, loose, identifier) : v
|
||||
}).forEach(function (v,i,_) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(["SemVer " + version
|
||||
,""
|
||||
,"A JavaScript implementation of the http://semver.org/ specification"
|
||||
,"Copyright Isaac Z. Schlueter"
|
||||
,""
|
||||
,"Usage: semver [options] <version> [<version> [...]]"
|
||||
,"Prints valid versions sorted by SemVer precedence"
|
||||
,""
|
||||
,"Options:"
|
||||
,"-r --range <range>"
|
||||
," Print versions that match the specified range."
|
||||
,""
|
||||
,"-i --increment [<level>]"
|
||||
," Increment a version by the specified level. Level can"
|
||||
," be one of: major, minor, patch, premajor, preminor,"
|
||||
," prepatch, or prerelease. Default level is 'patch'."
|
||||
," Only one version may be specified."
|
||||
,""
|
||||
,"--preid <identifier>"
|
||||
," Identifier to be used to prefix premajor, preminor,"
|
||||
," prepatch or prerelease version increments."
|
||||
,""
|
||||
,"-l --loose"
|
||||
," Interpret versions and ranges loosely"
|
||||
,""
|
||||
,"Program exits successfully if any valid version satisfies"
|
||||
,"all supplied ranges, and prints all satisfying versions."
|
||||
,""
|
||||
,"If no satisfying versions are found, then exits failure."
|
||||
,""
|
||||
,"Versions are printed in ascending order, so supplying"
|
||||
,"multiple versions to the utility will just sort them."
|
||||
].join("\n"))
|
||||
}
|
77
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/package.json
generated
vendored
Normal file
77
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"semver@~5.0.1",
|
||||
"/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/agent-base"
|
||||
]
|
||||
],
|
||||
"_from": "semver@>=5.0.1 <5.1.0",
|
||||
"_id": "semver@5.0.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/agent-base/semver",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
"email": "isaacs@npmjs.com",
|
||||
"name": "isaacs"
|
||||
},
|
||||
"_npmVersion": "3.3.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "semver",
|
||||
"raw": "semver@~5.0.1",
|
||||
"rawSpec": "~5.0.1",
|
||||
"scope": null,
|
||||
"spec": ">=5.0.1 <5.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/agent-base"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
|
||||
"_shasum": "77466de589cd5d3c95f138aa78bc569a3cb5d27a",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "semver@~5.0.1",
|
||||
"_where": "/Users/mromano/dev/dev-platform-webcomponents/ng2-components/ng2-alfresco-documentslist/node_modules/agent-base",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^1.3.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "77466de589cd5d3c95f138aa78bc569a3cb5d27a",
|
||||
"tarball": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz"
|
||||
},
|
||||
"gitHead": "5f89ecbe78145ad0b501cf6279f602a23c89738d",
|
||||
"homepage": "https://github.com/npm/node-semver#readme",
|
||||
"license": "ISC",
|
||||
"main": "semver.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "isaacs@npmjs.com",
|
||||
"name": "isaacs"
|
||||
},
|
||||
{
|
||||
"email": "ogd@aoaioxxysz.net",
|
||||
"name": "othiym23"
|
||||
}
|
||||
],
|
||||
"name": "semver",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "5.0.3"
|
||||
}
|
1200
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/semver.js
generated
vendored
Normal file
1200
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/big-numbers.js
generated
vendored
Normal file
31
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/big-numbers.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var test = require('tap').test
|
||||
var semver = require('../')
|
||||
|
||||
test('long version is too long', function (t) {
|
||||
var v = '1.2.' + new Array(256).join('1')
|
||||
t.throws(function () {
|
||||
new semver.SemVer(v)
|
||||
})
|
||||
t.equal(semver.valid(v, false), null)
|
||||
t.equal(semver.valid(v, true), null)
|
||||
t.equal(semver.inc(v, 'patch'), null)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('big number is like too long version', function (t) {
|
||||
var v = '1.2.' + new Array(100).join('1')
|
||||
t.throws(function () {
|
||||
new semver.SemVer(v)
|
||||
})
|
||||
t.equal(semver.valid(v, false), null)
|
||||
t.equal(semver.valid(v, true), null)
|
||||
t.equal(semver.inc(v, 'patch'), null)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('parsing null does not throw', function (t) {
|
||||
t.equal(semver.parse(null), null)
|
||||
t.equal(semver.parse({}), null)
|
||||
t.equal(semver.parse(new semver.SemVer('1.2.3')).version, '1.2.3')
|
||||
t.end()
|
||||
})
|
29
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/clean.js
generated
vendored
Normal file
29
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/clean.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var clean = semver.clean;
|
||||
|
||||
test('\nclean tests', function(t) {
|
||||
// [range, version]
|
||||
// Version should be detectable despite extra characters
|
||||
[
|
||||
['1.2.3', '1.2.3'],
|
||||
[' 1.2.3 ', '1.2.3'],
|
||||
[' 1.2.3-4 ', '1.2.3-4'],
|
||||
[' 1.2.3-pre ', '1.2.3-pre'],
|
||||
[' =v1.2.3 ', '1.2.3'],
|
||||
['v1.2.3', '1.2.3'],
|
||||
[' v1.2.3 ', '1.2.3'],
|
||||
['\t1.2.3', '1.2.3'],
|
||||
['>1.2.3', null],
|
||||
['~1.2.3', null],
|
||||
['<=1.2.3', null],
|
||||
['1.2.x', null]
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var msg = 'clean(' + range + ') = ' + version;
|
||||
t.equal(clean(range), version, msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
173
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/gtr.js
generated
vendored
Normal file
173
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/gtr.js
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var gtr = semver.gtr;
|
||||
|
||||
test('\ngtr tests', function(t) {
|
||||
// [range, version, loose]
|
||||
// Version should be greater than range
|
||||
[
|
||||
['~1.2.2', '1.3.0'],
|
||||
['~0.6.1-1', '0.7.1-1'],
|
||||
['1.0.0 - 2.0.0', '2.0.1'],
|
||||
['1.0.0', '1.0.1-beta1'],
|
||||
['1.0.0', '2.0.0'],
|
||||
['<=2.0.0', '2.1.1'],
|
||||
['<=2.0.0', '3.2.9'],
|
||||
['<2.0.0', '2.0.0'],
|
||||
['0.1.20 || 1.2.4', '1.2.5'],
|
||||
['2.x.x', '3.0.0'],
|
||||
['1.2.x', '1.3.0'],
|
||||
['1.2.x || 2.x', '3.0.0'],
|
||||
['2.*.*', '5.0.1'],
|
||||
['1.2.*', '1.3.3'],
|
||||
['1.2.* || 2.*', '4.0.0'],
|
||||
['2', '3.0.0'],
|
||||
['2.3', '2.4.2'],
|
||||
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.5.5'],
|
||||
['~>3.2.1', '3.3.0'], // >=3.2.1 <3.3.0
|
||||
['~1', '2.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '2.2.4'],
|
||||
['~> 1', '3.2.3'],
|
||||
['~1.0', '1.1.2'], // >=1.0.0 <1.1.0
|
||||
['~ 1.0', '1.1.0'],
|
||||
['<1.2', '1.2.0'],
|
||||
['< 1.2', '1.2.1'],
|
||||
['1', '2.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.6.0'],
|
||||
['~v0.5.4-pre', '0.6.1-pre'],
|
||||
['=0.7.x', '0.8.0'],
|
||||
['=0.7.x', '0.8.0-asdf'],
|
||||
['<0.7.x', '0.7.0'],
|
||||
['~1.2.2', '1.3.0'],
|
||||
['1.0.0 - 2.0.0', '2.2.3'],
|
||||
['1.0.0', '1.0.1'],
|
||||
['<=2.0.0', '3.0.0'],
|
||||
['<=2.0.0', '2.9999.9999'],
|
||||
['<=2.0.0', '2.2.9'],
|
||||
['<2.0.0', '2.9999.9999'],
|
||||
['<2.0.0', '2.2.9'],
|
||||
['2.x.x', '3.1.3'],
|
||||
['1.2.x', '1.3.3'],
|
||||
['1.2.x || 2.x', '3.1.3'],
|
||||
['2.*.*', '3.1.3'],
|
||||
['1.2.*', '1.3.3'],
|
||||
['1.2.* || 2.*', '3.1.3'],
|
||||
['2', '3.1.2'],
|
||||
['2.3', '2.4.1'],
|
||||
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
||||
['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0
|
||||
['~1', '2.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '2.2.3'],
|
||||
['~1.0', '1.1.0'], // >=1.0.0 <1.1.0
|
||||
['<1', '1.0.0'],
|
||||
['1', '2.0.0beta', true],
|
||||
['<1', '1.0.0beta', true],
|
||||
['< 1', '1.0.0beta', true],
|
||||
['=0.7.x', '0.8.2'],
|
||||
['<0.7.x', '0.7.2']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')';
|
||||
t.ok(gtr(version, range, loose), msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nnegative gtr tests', function(t) {
|
||||
// [range, version, loose]
|
||||
// Version should NOT be greater than range
|
||||
[
|
||||
['~0.6.1-1', '0.6.1-1'],
|
||||
['1.0.0 - 2.0.0', '1.2.3'],
|
||||
['1.0.0 - 2.0.0', '0.9.9'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '0.2.4'],
|
||||
['', '1.0.0', true],
|
||||
['*', '1.2.3'],
|
||||
['*', 'v1.2.3-foo'],
|
||||
['>=1.0.0', '1.0.0'],
|
||||
['>=1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '1.1.0'],
|
||||
['>1.0.0', '1.0.1'],
|
||||
['>1.0.0', '1.1.0'],
|
||||
['<=2.0.0', '2.0.0'],
|
||||
['<=2.0.0', '1.9999.9999'],
|
||||
['<=2.0.0', '0.2.9'],
|
||||
['<2.0.0', '1.9999.9999'],
|
||||
['<2.0.0', '0.2.9'],
|
||||
['>= 1.0.0', '1.0.0'],
|
||||
['>= 1.0.0', '1.0.1'],
|
||||
['>= 1.0.0', '1.1.0'],
|
||||
['> 1.0.0', '1.0.1'],
|
||||
['> 1.0.0', '1.1.0'],
|
||||
['<= 2.0.0', '2.0.0'],
|
||||
['<= 2.0.0', '1.9999.9999'],
|
||||
['<= 2.0.0', '0.2.9'],
|
||||
['< 2.0.0', '1.9999.9999'],
|
||||
['<\t2.0.0', '0.2.9'],
|
||||
['>=0.1.97', 'v0.1.97'],
|
||||
['>=0.1.97', '0.1.97'],
|
||||
['0.1.20 || 1.2.4', '1.2.4'],
|
||||
['0.1.20 || >1.2.4', '1.2.4'],
|
||||
['0.1.20 || 1.2.4', '1.2.3'],
|
||||
['0.1.20 || 1.2.4', '0.1.20'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.0'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.4'],
|
||||
['||', '1.3.4'],
|
||||
['2.x.x', '2.1.3'],
|
||||
['1.2.x', '1.2.3'],
|
||||
['1.2.x || 2.x', '2.1.3'],
|
||||
['1.2.x || 2.x', '1.2.3'],
|
||||
['x', '1.2.3'],
|
||||
['2.*.*', '2.1.3'],
|
||||
['1.2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '2.1.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['*', '1.2.3'],
|
||||
['2', '2.1.2'],
|
||||
['2.3', '2.3.1'],
|
||||
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.4.5'],
|
||||
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0
|
||||
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '1.2.3'],
|
||||
['~> 1', '1.2.3'],
|
||||
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0
|
||||
['~ 1.0', '1.0.2'],
|
||||
['>=1', '1.0.0'],
|
||||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['1', '1.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['>=0.7.x', '0.7.2'],
|
||||
['=0.7.x', '0.7.0-asdf'],
|
||||
['>=0.7.x', '0.7.0-asdf'],
|
||||
['<=0.7.x', '0.6.2'],
|
||||
['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'],
|
||||
['>=0.2.3 <=0.2.4', '0.2.4'],
|
||||
['1.0.0 - 2.0.0', '2.0.0'],
|
||||
['^1', '0.0.0-0'],
|
||||
['^3.0.0', '2.0.0'],
|
||||
['^1.0.0 || ~2.0.1', '2.0.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true],
|
||||
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')';
|
||||
t.notOk(gtr(version, range, loose), msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
698
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/index.js
generated
vendored
Normal file
698
ng2-components/ng2-alfresco-documentslist/dist/node_modules/agent-base/node_modules/semver/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,698 @@
|
||||
'use strict';
|
||||
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var eq = semver.eq;
|
||||
var gt = semver.gt;
|
||||
var lt = semver.lt;
|
||||
var neq = semver.neq;
|
||||
var cmp = semver.cmp;
|
||||
var gte = semver.gte;
|
||||
var lte = semver.lte;
|
||||
var satisfies = semver.satisfies;
|
||||
var validRange = semver.validRange;
|
||||
var inc = semver.inc;
|
||||
var diff = semver.diff;
|
||||
var replaceStars = semver.replaceStars;
|
||||
var toComparators = semver.toComparators;
|
||||
var SemVer = semver.SemVer;
|
||||
var Range = semver.Range;
|
||||
|
||||
test('\ncomparison tests', function(t) {
|
||||
// [version1, version2]
|
||||
// version1 should be greater than version2
|
||||
[['0.0.0', '0.0.0-foo'],
|
||||
['0.0.1', '0.0.0'],
|
||||
['1.0.0', '0.9.9'],
|
||||
['0.10.0', '0.9.0'],
|
||||
['0.99.0', '0.10.0'],
|
||||
['2.0.0', '1.2.3'],
|
||||
['v0.0.0', '0.0.0-foo', true],
|
||||
['v0.0.1', '0.0.0', true],
|
||||
['v1.0.0', '0.9.9', true],
|
||||
['v0.10.0', '0.9.0', true],
|
||||
['v0.99.0', '0.10.0', true],
|
||||
['v2.0.0', '1.2.3', true],
|
||||
['0.0.0', 'v0.0.0-foo', true],
|
||||
['0.0.1', 'v0.0.0', true],
|
||||
['1.0.0', 'v0.9.9', true],
|
||||
['0.10.0', 'v0.9.0', true],
|
||||
['0.99.0', 'v0.10.0', true],
|
||||
['2.0.0', 'v1.2.3', true],
|
||||
['1.2.3', '1.2.3-asdf'],
|
||||
['1.2.3', '1.2.3-4'],
|
||||
['1.2.3', '1.2.3-4-foo'],
|
||||
['1.2.3-5-foo', '1.2.3-5'],
|
||||
['1.2.3-5', '1.2.3-4'],
|
||||
['1.2.3-5-foo', '1.2.3-5-Foo'],
|
||||
['3.0.0', '2.7.2+asdf'],
|
||||
['1.2.3-a.10', '1.2.3-a.5'],
|
||||
['1.2.3-a.b', '1.2.3-a.5'],
|
||||
['1.2.3-a.b', '1.2.3-a'],
|
||||
['1.2.3-a.b.c.10.d.5', '1.2.3-a.b.c.5.d.100'],
|
||||
['1.2.3-r2', '1.2.3-r100'],
|
||||
['1.2.3-r100', '1.2.3-R2']
|
||||
].forEach(function(v) {
|
||||
var v0 = v[0];
|
||||
var v1 = v[1];
|
||||
var loose = v[2];
|
||||
t.ok(gt(v0, v1, loose), "gt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(lt(v1, v0, loose), "lt('" + v1 + "', '" + v0 + "')");
|
||||
t.ok(!gt(v1, v0, loose), "!gt('" + v1 + "', '" + v0 + "')");
|
||||
t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(eq(v0, v0, loose), "eq('" + v0 + "', '" + v0 + "')");
|
||||
t.ok(eq(v1, v1, loose), "eq('" + v1 + "', '" + v1 + "')");
|
||||
t.ok(neq(v0, v1, loose), "neq('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(cmp(v1, '==', v1, loose), "cmp('" + v1 + "' == '" + v1 + "')");
|
||||
t.ok(cmp(v0, '>=', v1, loose), "cmp('" + v0 + "' >= '" + v1 + "')");
|
||||
t.ok(cmp(v1, '<=', v0, loose), "cmp('" + v1 + "' <= '" + v0 + "')");
|
||||
t.ok(cmp(v0, '!=', v1, loose), "cmp('" + v0 + "' != '" + v1 + "')");
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nequality tests', function(t) {
|
||||
// [version1, version2]
|
||||
// version1 should be equivalent to version2
|
||||
[['1.2.3', 'v1.2.3', true],
|
||||
['1.2.3', '=1.2.3', true],
|
||||
['1.2.3', 'v 1.2.3', true],
|
||||
['1.2.3', '= 1.2.3', true],
|
||||
['1.2.3', ' v1.2.3', true],
|
||||
['1.2.3', ' =1.2.3', true],
|
||||
['1.2.3', ' v 1.2.3', true],
|
||||
['1.2.3', ' = 1.2.3', true],
|
||||
['1.2.3-0', 'v1.2.3-0', true],
|
||||
['1.2.3-0', '=1.2.3-0', true],
|
||||
['1.2.3-0', 'v 1.2.3-0', true],
|
||||
['1.2.3-0', '= 1.2.3-0', true],
|
||||
['1.2.3-0', ' v1.2.3-0', true],
|
||||
['1.2.3-0', ' =1.2.3-0', true],
|
||||
['1.2.3-0', ' v 1.2.3-0', true],
|
||||
['1.2.3-0', ' = 1.2.3-0', true],
|
||||
['1.2.3-1', 'v1.2.3-1', true],
|
||||
['1.2.3-1', '=1.2.3-1', true],
|
||||
['1.2.3-1', 'v 1.2.3-1', true],
|
||||
['1.2.3-1', '= 1.2.3-1', true],
|
||||
['1.2.3-1', ' v1.2.3-1', true],
|
||||
['1.2.3-1', ' =1.2.3-1', true],
|
||||
['1.2.3-1', ' v 1.2.3-1', true],
|
||||
['1.2.3-1', ' = 1.2.3-1', true],
|
||||
['1.2.3-beta', 'v1.2.3-beta', true],
|
||||
['1.2.3-beta', '=1.2.3-beta', true],
|
||||
['1.2.3-beta', 'v 1.2.3-beta', true],
|
||||
['1.2.3-beta', '= 1.2.3-beta', true],
|
||||
['1.2.3-beta', ' v1.2.3-beta', true],
|
||||
['1.2.3-beta', ' =1.2.3-beta', true],
|
||||
['1.2.3-beta', ' v 1.2.3-beta', true],
|
||||
['1.2.3-beta', ' = 1.2.3-beta', true],
|
||||
['1.2.3-beta+build', ' = 1.2.3-beta+otherbuild', true],
|
||||
['1.2.3+build', ' = 1.2.3+otherbuild', true],
|
||||
['1.2.3-beta+build', '1.2.3-beta+otherbuild'],
|
||||
['1.2.3+build', '1.2.3+otherbuild'],
|
||||
[' v1.2.3+build', '1.2.3+otherbuild']
|
||||
].forEach(function(v) {
|
||||
var v0 = v[0];
|
||||
var v1 = v[1];
|
||||
var loose = v[2];
|
||||
t.ok(eq(v0, v1, loose), "eq('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(!neq(v0, v1, loose), "!neq('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(cmp(v0, '==', v1, loose), 'cmp(' + v0 + '==' + v1 + ')');
|
||||
t.ok(!cmp(v0, '!=', v1, loose), '!cmp(' + v0 + '!=' + v1 + ')');
|
||||
t.ok(!cmp(v0, '===', v1, loose), '!cmp(' + v0 + '===' + v1 + ')');
|
||||
t.ok(cmp(v0, '!==', v1, loose), 'cmp(' + v0 + '!==' + v1 + ')');
|
||||
t.ok(!gt(v0, v1, loose), "!gt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(gte(v0, v1, loose), "gte('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(lte(v0, v1, loose), "lte('" + v0 + "', '" + v1 + "')");
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('\nrange tests', function(t) {
|
||||
// [range, version]
|
||||
// version should be included by range
|
||||
[['1.0.0 - 2.0.0', '1.2.3'],
|
||||
['^1.2.3+build', '1.2.3'],
|
||||
['^1.2.3+build', '1.3.0'],
|
||||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3'],
|
||||
['1.2.3pre+asdf - 2.4.3-pre+asdf', '1.2.3', true],
|
||||
['1.2.3-pre+asdf - 2.4.3pre+asdf', '1.2.3', true],
|
||||
['1.2.3pre+asdf - 2.4.3pre+asdf', '1.2.3', true],
|
||||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3-pre.2'],
|
||||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '2.4.3-alpha'],
|
||||
['1.2.3+asdf - 2.4.3+asdf', '1.2.3'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '0.2.4'],
|
||||
['', '1.0.0'],
|
||||
['*', '1.2.3'],
|
||||
['*', 'v1.2.3', true],
|
||||
['>=1.0.0', '1.0.0'],
|
||||
['>=1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '1.1.0'],
|
||||
['>1.0.0', '1.0.1'],
|
||||
['>1.0.0', '1.1.0'],
|
||||
['<=2.0.0', '2.0.0'],
|
||||
['<=2.0.0', '1.9999.9999'],
|
||||
['<=2.0.0', '0.2.9'],
|
||||
['<2.0.0', '1.9999.9999'],
|
||||
['<2.0.0', '0.2.9'],
|
||||
['>= 1.0.0', '1.0.0'],
|
||||
['>= 1.0.0', '1.0.1'],
|
||||
['>= 1.0.0', '1.1.0'],
|
||||
['> 1.0.0', '1.0.1'],
|
||||
['> 1.0.0', '1.1.0'],
|
||||
['<= 2.0.0', '2.0.0'],
|
||||
['<= 2.0.0', '1.9999.9999'],
|
||||
['<= 2.0.0', '0.2.9'],
|
||||
['< 2.0.0', '1.9999.9999'],
|
||||
['<\t2.0.0', '0.2.9'],
|
||||
['>=0.1.97', 'v0.1.97', true],
|
||||
['>=0.1.97', '0.1.97'],
|
||||
['0.1.20 || 1.2.4', '1.2.4'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.0'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.4'],
|
||||
['||', '1.3.4'],
|
||||
['2.x.x', '2.1.3'],
|
||||
['1.2.x', '1.2.3'],
|
||||
['1.2.x || 2.x', '2.1.3'],
|
||||
['1.2.x || 2.x', '1.2.3'],
|
||||
['x', '1.2.3'],
|
||||
['2.*.*', '2.1.3'],
|
||||
['1.2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '2.1.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['*', '1.2.3'],
|
||||
['2', '2.1.2'],
|
||||
['2.3', '2.3.1'],
|
||||
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.4.5'],
|
||||
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0,
|
||||
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '1.2.3'],
|
||||
['~> 1', '1.2.3'],
|
||||
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0,
|
||||
['~ 1.0', '1.0.2'],
|
||||
['~ 1.0.3', '1.0.12'],
|
||||
['>=1', '1.0.0'],
|
||||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['<=0.7.x', '0.7.2'],
|
||||
['>=0.7.x', '0.7.2'],
|
||||
['<=0.7.x', '0.6.2'],
|
||||
['~1.2.1 >=1.2.3', '1.2.3'],
|
||||
['~1.2.1 =1.2.3', '1.2.3'],
|
||||
['~1.2.1 1.2.3', '1.2.3'],
|
||||
['~1.2.1 >=1.2.3 1.2.3', '1.2.3'],
|
||||
['~1.2.1 1.2.3 >=1.2.3', '1.2.3'],
|
||||
['~1.2.1 1.2.3', '1.2.3'],
|
||||
['>=1.2.1 1.2.3', '1.2.3'],
|
||||
['1.2.3 >=1.2.1', '1.2.3'],
|
||||
['>=1.2.3 >=1.2.1', '1.2.3'],
|
||||
['>=1.2.1 >=1.2.3', '1.2.3'],
|
||||
['>=1.2', '1.2.8'],
|
||||
['^1.2.3', '1.8.1'],
|
||||
['^0.1.2', '0.1.2'],
|
||||
['^0.1', '0.1.2'],
|
||||
['^1.2', '1.4.2'],
|
||||
['^1.2 ^1', '1.4.2'],
|
||||
['^1.2.3-alpha', '1.2.3-pre'],
|
||||
['^1.2.0-alpha', '1.2.0-pre'],
|
||||
['^0.0.1-alpha', '0.0.1-beta']
|
||||
].forEach(function(v) {
|
||||
var range = v[0];
|
||||
var ver = v[1];
|
||||
var loose = v[2];
|
||||
t.ok(satisfies(ver, range, loose), range + ' satisfied by ' + ver);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nnegative range tests', function(t) {
|
||||
// [range, version]
|
||||
// version should not be included by range
|
||||
[['1.0.0 - 2.0.0', '2.2.3'],
|
||||
['1.2.3+asdf - 2.4.3+asdf', '1.2.3-pre.2'],
|
||||
['1.2.3+asdf - 2.4.3+asdf', '2.4.3-alpha'],
|
||||
['^1.2.3+build', '2.0.0'],
|
||||
['^1.2.3+build', '1.2.0'],
|
||||
['^1.2.3', '1.2.3-pre'],
|
||||
['^1.2', '1.2.0-pre'],
|
||||
['>1.2', '1.3.0-beta'],
|
||||
['<=1.2.3', '1.2.3-beta'],
|
||||
['^1.2.3', '1.2.3-beta'],
|
||||
['=0.7.x', '0.7.0-asdf'],
|
||||
['>=0.7.x', '0.7.0-asdf'],
|
||||
['1', '1.0.0beta', true],
|
||||
['<1', '1.0.0beta', true],
|
||||
['< 1', '1.0.0beta', true],
|
||||
['1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '0.0.0'],
|
||||
['>=1.0.0', '0.0.1'],
|
||||
['>=1.0.0', '0.1.0'],
|
||||
['>1.0.0', '0.0.1'],
|
||||
['>1.0.0', '0.1.0'],
|
||||
['<=2.0.0', '3.0.0'],
|
||||
['<=2.0.0', '2.9999.9999'],
|
||||
['<=2.0.0', '2.2.9'],
|
||||
['<2.0.0', '2.9999.9999'],
|
||||
['<2.0.0', '2.2.9'],
|
||||
['>=0.1.97', 'v0.1.93', true],
|
||||
['>=0.1.97', '0.1.93'],
|
||||
['0.1.20 || 1.2.4', '1.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.2'],
|
||||
['2.x.x', '1.1.3'],
|
||||
['2.x.x', '3.1.3'],
|
||||
['1.2.x', '1.3.3'],
|
||||
['1.2.x || 2.x', '3.1.3'],
|
||||
['1.2.x || 2.x', '1.1.3'],
|
||||
['2.*.*', '1.1.3'],
|
||||
['2.*.*', '3.1.3'],
|
||||
['1.2.*', '1.3.3'],
|
||||
['1.2.* || 2.*', '3.1.3'],
|
||||
['1.2.* || 2.*', '1.1.3'],
|
||||
['2', '1.1.2'],
|
||||
['2.3', '2.4.1'],
|
||||
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.3.9'],
|
||||
['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0
|
||||
['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0
|
||||
['~1', '0.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '2.2.3'],
|
||||
['~1.0', '1.1.0'], // >=1.0.0 <1.1.0
|
||||
['<1', '1.0.0'],
|
||||
['>=1.2', '1.1.1'],
|
||||
['1', '2.0.0beta', true],
|
||||
['~v0.5.4-beta', '0.5.4-alpha'],
|
||||
['=0.7.x', '0.8.2'],
|
||||
['>=0.7.x', '0.6.2'],
|
||||
['<0.7.x', '0.7.2'],
|
||||
['<1.2.3', '1.2.3-beta'],
|
||||
['=1.2.3', '1.2.3-beta'],
|
||||
['>1.2', '1.2.8'],
|
||||
['^1.2.3', '2.0.0-alpha'],
|
||||
['^1.2.3', '1.2.2'],
|
||||
['^1.2', '1.1.9'],
|
||||
['*', 'v1.2.3-foo', true],
|
||||
// invalid ranges never satisfied!
|
||||
['blerg', '1.2.3'],
|
||||
['git+https://user:password0123@github.com/foo', '123.0.0', true],
|
||||
['^1.2.3', '2.0.0-pre']
|
||||
].forEach(function(v) {
|
||||
var range = v[0];
|
||||
var ver = v[1];
|
||||
var loose = v[2];
|
||||
var found = satisfies(ver, range, loose);
|
||||
t.ok(!found, ver + ' not satisfied by ' + range);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nincrement versions test', function(t) {
|
||||
// [version, inc, result, identifier]
|
||||
// inc(version, inc) -> result
|
||||
[['1.2.3', 'major', '2.0.0'],
|
||||
['1.2.3', 'minor', '1.3.0'],
|
||||
['1.2.3', 'patch', '1.2.4'],
|
||||
['1.2.3tag', 'major', '2.0.0', true],
|
||||
['1.2.3-tag', 'major', '2.0.0'],
|
||||
['1.2.3', 'fake', null],
|
||||
['1.2.0-0', 'patch', '1.2.0'],
|
||||
['fake', 'major', null],
|
||||
['1.2.3-4', 'major', '2.0.0'],
|
||||
['1.2.3-4', 'minor', '1.3.0'],
|
||||
['1.2.3-4', 'patch', '1.2.3'],
|
||||
['1.2.3-alpha.0.beta', 'major', '2.0.0'],
|
||||
['1.2.3-alpha.0.beta', 'minor', '1.3.0'],
|
||||
['1.2.3-alpha.0.beta', 'patch', '1.2.3'],
|
||||
['1.2.4', 'prerelease', '1.2.5-0'],
|
||||
['1.2.3-0', 'prerelease', '1.2.3-1'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'],
|
||||
['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'],
|
||||
['1.2.3-alpha.2', 'prerelease', '1.2.3-alpha.3'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta'],
|
||||
['1.2.3-alpha.1.beta', 'prerelease', '1.2.3-alpha.2.beta'],
|
||||
['1.2.3-alpha.2.beta', 'prerelease', '1.2.3-alpha.3.beta'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta'],
|
||||
['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta'],
|
||||
['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1'],
|
||||
['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2'],
|
||||
['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'],
|
||||
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'],
|
||||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'],
|
||||
['1.2.0', 'prepatch', '1.2.1-0'],
|
||||
['1.2.0-1', 'prepatch', '1.2.1-0'],
|
||||
['1.2.0', 'preminor', '1.3.0-0'],
|
||||
['1.2.3-1', 'preminor', '1.3.0-0'],
|
||||
['1.2.0', 'premajor', '2.0.0-0'],
|
||||
['1.2.3-1', 'premajor', '2.0.0-0'],
|
||||
['1.2.0-1', 'minor', '1.2.0'],
|
||||
['1.0.0-1', 'major', '1.0.0'],
|
||||
|
||||
['1.2.3', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3', 'patch', '1.2.4', false, 'dev'],
|
||||
['1.2.3tag', 'major', '2.0.0', true, 'dev'],
|
||||
['1.2.3-tag', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3', 'fake', null, false, 'dev'],
|
||||
['1.2.0-0', 'patch', '1.2.0', false, 'dev'],
|
||||
['fake', 'major', null, false, 'dev'],
|
||||
['1.2.3-4', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3-4', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3-4', 'patch', '1.2.3', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'patch', '1.2.3', false, 'dev'],
|
||||
['1.2.4', 'prerelease', '1.2.5-dev.0', false, 'dev'],
|
||||
['1.2.3-0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1', false, 'alpha'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3', false, 'alpha'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta', false, 'alpha'],
|
||||
['1.2.0', 'prepatch', '1.2.1-dev.0', false, 'dev'],
|
||||
['1.2.0-1', 'prepatch', '1.2.1-dev.0', false, 'dev'],
|
||||
['1.2.0', 'preminor', '1.3.0-dev.0', false, 'dev'],
|
||||
['1.2.3-1', 'preminor', '1.3.0-dev.0', false, 'dev'],
|
||||
['1.2.0', 'premajor', '2.0.0-dev.0', false, 'dev'],
|
||||
['1.2.3-1', 'premajor', '2.0.0-dev.0', false, 'dev'],
|
||||
['1.2.0-1', 'minor', '1.2.0', false, 'dev'],
|
||||
['1.0.0-1', 'major', '1.0.0', false, 'dev'],
|
||||
['1.2.3-dev.bar', 'prerelease', '1.2.3-dev.0', false, 'dev']
|
||||
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var what = v[1];
|
||||
var wanted = v[2];
|
||||
var loose = v[3];
|
||||
var id = v[4];
|
||||
var found = inc(pre, what, loose, id);
|
||||
var cmd = 'inc(' + pre + ', ' + what + ', ' + id + ')';
|
||||
t.equal(found, wanted, cmd + ' === ' + wanted);
|
||||
|
||||
var parsed = semver.parse(pre, loose);
|
||||
if (wanted) {
|
||||
parsed.inc(what, id);
|
||||
t.equal(parsed.version, wanted, cmd + ' object version updated');
|
||||
t.equal(parsed.raw, wanted, cmd + ' object raw field updated');
|
||||
} else if (parsed) {
|
||||
t.throws(function () {
|
||||
parsed.inc(what, id)
|
||||
})
|
||||
} else {
|
||||
t.equal(parsed, null)
|
||||
}
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\ndiff versions test', function(t) {
|
||||
// [version1, version2, result]
|
||||
// diff(version1, version2) -> result
|
||||
[['1.2.3', '0.2.3', 'major'],
|
||||
['1.4.5', '0.2.3', 'major'],
|
||||
['1.2.3', '2.0.0-pre', 'premajor'],
|
||||
['1.2.3', '1.3.3', 'minor'],
|
||||
['1.0.1', '1.1.0-pre', 'preminor'],
|
||||
['1.2.3', '1.2.4', 'patch'],
|
||||
['1.2.3', '1.2.4-pre', 'prepatch'],
|
||||
['0.0.1', '0.0.1-pre', 'prerelease'],
|
||||
['0.0.1', '0.0.1-pre-2', 'prerelease'],
|
||||
['1.1.0', '1.1.0-pre', 'prerelease'],
|
||||
['1.1.0-pre-1', '1.1.0-pre-2', 'prerelease'],
|
||||
['1.0.0', '1.0.0', null]
|
||||
|
||||
].forEach(function(v) {
|
||||
var version1 = v[0];
|
||||
var version2 = v[1];
|
||||
var wanted = v[2];
|
||||
var found = diff(version1, version2);
|
||||
var cmd = 'diff(' + version1 + ', ' + version2 + ')';
|
||||
t.equal(found, wanted, cmd + ' === ' + wanted);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nvalid range test', function(t) {
|
||||
// [range, result]
|
||||
// validRange(range) -> result
|
||||
// translate ranges into their canonical form
|
||||
[['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '*'],
|
||||
['', '*'],
|
||||
['*', '*'],
|
||||
['*', '*'],
|
||||
['>=1.0.0', '>=1.0.0'],
|
||||
['>1.0.0', '>1.0.0'],
|
||||
['<=2.0.0', '<=2.0.0'],
|
||||
['1', '>=1.0.0 <2.0.0'],
|
||||
['<=2.0.0', '<=2.0.0'],
|
||||
['<=2.0.0', '<=2.0.0'],
|
||||
['<2.0.0', '<2.0.0'],
|
||||
['<2.0.0', '<2.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['> 1.0.0', '>1.0.0'],
|
||||
['> 1.0.0', '>1.0.0'],
|
||||
['<= 2.0.0', '<=2.0.0'],
|
||||
['<= 2.0.0', '<=2.0.0'],
|
||||
['<= 2.0.0', '<=2.0.0'],
|
||||
['< 2.0.0', '<2.0.0'],
|
||||
['< 2.0.0', '<2.0.0'],
|
||||
['>=0.1.97', '>=0.1.97'],
|
||||
['>=0.1.97', '>=0.1.97'],
|
||||
['0.1.20 || 1.2.4', '0.1.20||1.2.4'],
|
||||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'],
|
||||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'],
|
||||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'],
|
||||
['||', '||'],
|
||||
['2.x.x', '>=2.0.0 <3.0.0'],
|
||||
['1.2.x', '>=1.2.0 <1.3.0'],
|
||||
['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'],
|
||||
['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'],
|
||||
['x', '*'],
|
||||
['2.*.*', '>=2.0.0 <3.0.0'],
|
||||
['1.2.*', '>=1.2.0 <1.3.0'],
|
||||
['1.2.* || 2.*', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'],
|
||||
['*', '*'],
|
||||
['2', '>=2.0.0 <3.0.0'],
|
||||
['2.3', '>=2.3.0 <2.4.0'],
|
||||
['~2.4', '>=2.4.0 <2.5.0'],
|
||||
['~2.4', '>=2.4.0 <2.5.0'],
|
||||
['~>3.2.1', '>=3.2.1 <3.3.0'],
|
||||
['~1', '>=1.0.0 <2.0.0'],
|
||||
['~>1', '>=1.0.0 <2.0.0'],
|
||||
['~> 1', '>=1.0.0 <2.0.0'],
|
||||
['~1.0', '>=1.0.0 <1.1.0'],
|
||||
['~ 1.0', '>=1.0.0 <1.1.0'],
|
||||
['^0', '>=0.0.0 <1.0.0'],
|
||||
['^ 1', '>=1.0.0 <2.0.0'],
|
||||
['^0.1', '>=0.1.0 <0.2.0'],
|
||||
['^1.0', '>=1.0.0 <2.0.0'],
|
||||
['^1.2', '>=1.2.0 <2.0.0'],
|
||||
['^0.0.1', '>=0.0.1 <0.0.2'],
|
||||
['^0.0.1-beta', '>=0.0.1-beta <0.0.2'],
|
||||
['^0.1.2', '>=0.1.2 <0.2.0'],
|
||||
['^1.2.3', '>=1.2.3 <2.0.0'],
|
||||
['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0'],
|
||||
['<1', '<1.0.0'],
|
||||
['< 1', '<1.0.0'],
|
||||
['>=1', '>=1.0.0'],
|
||||
['>= 1', '>=1.0.0'],
|
||||
['<1.2', '<1.2.0'],
|
||||
['< 1.2', '<1.2.0'],
|
||||
['1', '>=1.0.0 <2.0.0'],
|
||||
['>01.02.03', '>1.2.3', true],
|
||||
['>01.02.03', null],
|
||||
['~1.2.3beta', '>=1.2.3-beta <1.3.0', true],
|
||||
['~1.2.3beta', null],
|
||||
['^ 1.2 ^ 1', '>=1.2.0 <2.0.0 >=1.0.0 <2.0.0']
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var wanted = v[1];
|
||||
var loose = v[2];
|
||||
var found = validRange(pre, loose);
|
||||
|
||||
t.equal(found, wanted, 'validRange(' + pre + ') === ' + wanted);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\ncomparators test', function(t) {
|
||||
// [range, comparators]
|
||||
// turn range into a set of individual comparators
|
||||
[['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]],
|
||||
['1.0.0', [['1.0.0']]],
|
||||
['>=*', [['']]],
|
||||
['', [['']]],
|
||||
['*', [['']]],
|
||||
['*', [['']]],
|
||||
['>=1.0.0', [['>=1.0.0']]],
|
||||
['>=1.0.0', [['>=1.0.0']]],
|
||||
['>=1.0.0', [['>=1.0.0']]],
|
||||
['>1.0.0', [['>1.0.0']]],
|
||||
['>1.0.0', [['>1.0.0']]],
|
||||
['<=2.0.0', [['<=2.0.0']]],
|
||||
['1', [['>=1.0.0', '<2.0.0']]],
|
||||
['<=2.0.0', [['<=2.0.0']]],
|
||||
['<=2.0.0', [['<=2.0.0']]],
|
||||
['<2.0.0', [['<2.0.0']]],
|
||||
['<2.0.0', [['<2.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['> 1.0.0', [['>1.0.0']]],
|
||||
['> 1.0.0', [['>1.0.0']]],
|
||||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['< 2.0.0', [['<2.0.0']]],
|
||||
['<\t2.0.0', [['<2.0.0']]],
|
||||
['>=0.1.97', [['>=0.1.97']]],
|
||||
['>=0.1.97', [['>=0.1.97']]],
|
||||
['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]],
|
||||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]],
|
||||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]],
|
||||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]],
|
||||
['||', [[''], ['']]],
|
||||
['2.x.x', [['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.x', [['>=1.2.0', '<1.3.0']]],
|
||||
['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['x', [['']]],
|
||||
['2.*.*', [['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.*', [['>=1.2.0', '<1.3.0']]],
|
||||
['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['*', [['']]],
|
||||
['2', [['>=2.0.0', '<3.0.0']]],
|
||||
['2.3', [['>=2.3.0', '<2.4.0']]],
|
||||
['~2.4', [['>=2.4.0', '<2.5.0']]],
|
||||
['~2.4', [['>=2.4.0', '<2.5.0']]],
|
||||
['~>3.2.1', [['>=3.2.1', '<3.3.0']]],
|
||||
['~1', [['>=1.0.0', '<2.0.0']]],
|
||||
['~>1', [['>=1.0.0', '<2.0.0']]],
|
||||
['~> 1', [['>=1.0.0', '<2.0.0']]],
|
||||
['~1.0', [['>=1.0.0', '<1.1.0']]],
|
||||
['~ 1.0', [['>=1.0.0', '<1.1.0']]],
|
||||
['~ 1.0.3', [['>=1.0.3', '<1.1.0']]],
|
||||
['~> 1.0.3', [['>=1.0.3', '<1.1.0']]],
|
||||
['<1', [['<1.0.0']]],
|
||||
['< 1', [['<1.0.0']]],
|
||||
['>=1', [['>=1.0.0']]],
|
||||
['>= 1', [['>=1.0.0']]],
|
||||
['<1.2', [['<1.2.0']]],
|
||||
['< 1.2', [['<1.2.0']]],
|
||||
['1', [['>=1.0.0', '<2.0.0']]],
|
||||
['1 2', [['>=1.0.0', '<2.0.0', '>=2.0.0', '<3.0.0']]],
|
||||
['1.2 - 3.4.5', [['>=1.2.0', '<=3.4.5']]],
|
||||
['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0']]],
|
||||
['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]],
|
||||
['>*', [['<0.0.0']]],
|
||||
['<*', [['<0.0.0']]]
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var wanted = v[1];
|
||||
var found = toComparators(v[0]);
|
||||
var jw = JSON.stringify(wanted);
|
||||
t.equivalent(found, wanted, 'toComparators(' + pre + ') === ' + jw);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\ninvalid version numbers', function(t) {
|
||||
['1.2.3.4',
|
||||
'NOT VALID',
|
||||
1.2,
|
||||
null,
|
||||
'Infinity.NaN.Infinity'
|
||||
].forEach(function(v) {
|
||||
t.throws(function() {
|
||||
new SemVer(v);
|
||||
}, {name:'TypeError', message:'Invalid Version: ' + v});
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nstrict vs loose version numbers', function(t) {
|
||||
[['=1.2.3', '1.2.3'],
|
||||
['01.02.03', '1.2.3'],
|
||||
['1.2.3-beta.01', '1.2.3-beta.1'],
|
||||
[' =1.2.3', '1.2.3'],
|
||||
['1.2.3foo', '1.2.3-foo']
|
||||
].forEach(function(v) {
|
||||
var loose = v[0];
|
||||
var strict = v[1];
|
||||
t.throws(function() {
|
||||
new SemVer(loose);
|
||||
});
|
||||
var lv = new SemVer(loose, true);
|
||||
t.equal(lv.version, strict);
|
||||
t.ok(eq(loose, strict, true));
|
||||
t.throws(function() {
|
||||
eq(loose, strict);
|
||||
});
|
||||
t.throws(function() {
|
||||
new SemVer(strict).compare(loose);
|
||||
});
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nstrict vs loose ranges', function(t) {
|
||||
[['>=01.02.03', '>=1.2.3'],
|
||||
['~1.02.03beta', '>=1.2.3-beta <1.3.0']
|
||||
].forEach(function(v) {
|
||||
var loose = v[0];
|
||||
var comps = v[1];
|
||||
t.throws(function() {
|
||||
new Range(loose);
|
||||
});
|
||||
t.equal(new Range(loose, true).range, comps);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nmax satisfying', function(t) {
|
||||
[[['1.2.3', '1.2.4'], '1.2', '1.2.4'],
|
||||
[['1.2.4', '1.2.3'], '1.2', '1.2.4'],
|
||||
[['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~1.2.3', '1.2.6'],
|
||||
[['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0'], '~2.0.0', '2.0.0', true]
|
||||
].forEach(function(v) {
|
||||
var versions = v[0];
|
||||
var range = v[1];
|
||||
var expect = v[2];
|
||||
var loose = v[3];
|
||||
var actual = semver.maxSatisfying(versions, range, loose);
|
||||
t.equal(actual, expect);
|
||||
});
|
||||
t.end();
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user