From 84eba1d3f84ac269dd1b0b7acf4004711db1e5dc Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Wed, 24 Oct 2018 17:03:24 -0700 Subject: [PATCH] chore(all): prepare release 1.2.0 --- dist/index.d.ts | 1 + dist/index.js | 2 ++ dist/index.js.map | 2 +- dist/nodejs-pal-builder.d.ts | 1 + dist/nodejs-pal-builder.js | 2 +- dist/nodejs-pal-builder.js.map | 2 +- package.json | 2 +- 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 7d921bf..0e9bb3a 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,4 +1,5 @@ /// +export { ensurePerformance } from './nodejs-pal-builder'; /** * Initializes the PAL with the NodeJS-targeted implementation. */ diff --git a/dist/index.js b/dist/index.js index b718104..68a69a7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); const aurelia_pal_1 = require("aurelia-pal"); const nodejs_pal_builder_1 = require("./nodejs-pal-builder"); const mutation_observer_1 = require("./polyfills/mutation-observer"); +var nodejs_pal_builder_2 = require("./nodejs-pal-builder"); +exports.ensurePerformance = nodejs_pal_builder_2.ensurePerformance; /** * Initializes the PAL with the NodeJS-targeted implementation. */ diff --git a/dist/index.js.map b/dist/index.js.map index 09cb05c..50f7a68 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":[],"mappings":";AAAA,2CAA2C;;AAE3C,6CAAmF;AACnF,6DAAgD;AAChD,qEAAiE;AAEjE;;EAEE;AACF;IACE,IAAI,2BAAa,EAAE;QACjB,OAAO;KACR;IAED,IAAI,GAAG,GAAG,6BAAQ,EAAE,CAAC;IAErB,2BAAa,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QACvC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,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esContent":["/// \n\nimport { initializePAL, DOM, PLATFORM, FEATURE, isInitialized } from 'aurelia-pal';\nimport { buildPal } from './nodejs-pal-builder';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\n/**\n* Initializes the PAL with the NodeJS-targeted implementation.\n*/\nexport function initialize(): void {\n if (isInitialized) {\n return;\n }\n\n let pal = buildPal();\n\n initializePAL((platform, feature, dom) => {\n Object.assign(platform, pal.platform);\n Object.setPrototypeOf(platform, pal.platform.constructor.prototype);\n\n Object.assign(dom, pal.dom);\n Object.setPrototypeOf(dom, pal.dom.constructor.prototype);\n\n Object.assign(feature, pal.feature);\n Object.setPrototypeOf(feature, pal.feature.constructor.prototype);\n\n (function (global) {\n global.console = global.console || {};\n let con = global.console;\n let prop;\n let method;\n let empty = {};\n let dummy = function () { };\n let properties = 'memory'.split(',');\n let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = empty;\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n })(platform.global);\n\n if (platform.global.console && typeof console.log === 'object') {\n if (typeof console['debug'] === 'undefined') {\n console['debug'] = this.bind(console['log'], console);\n }\n ['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) {\n console[method] = this.bind(console[method], console);\n }, Function.prototype.call);\n }\n\n Object.defineProperty(dom, 'title', {\n get: function () {\n return pal.global.document.title;\n },\n set: function (value) {\n pal.global.document.title = value;\n }\n });\n\n Object.defineProperty(dom, 'activeElement', {\n get: function () {\n return pal.global.document.activeElement;\n }\n });\n\n Object.defineProperty(platform, 'XMLHttpRequest', {\n get: function () {\n return pal.global.XMLHttpRequest;\n }\n });\n });\n}\n\n/**\n * @description initializes and makes variables like 'window' into NodeJS globals\n */\nexport function globalize() {\n initialize();\n global.window = global.self = PLATFORM.global;\n global.document = PLATFORM.global.document;\n global.Element = DOM.Element;\n global.NodeList = PLATFORM.global.NodeList;\n global.SVGElement = DOM.SVGElement;\n global.HTMLElement = PLATFORM.global.HTMLElement;\n global.requestAnimationFrame = PLATFORM.global.requestAnimationFrame;\n global.location = PLATFORM.location;\n global.history = PLATFORM.history;\n global.System = {\n import(moduleId: string) {\n try {\n return Promise.resolve(require(moduleId));\n } catch (e) {\n return Promise.reject(e);\n }\n }\n };\n global.PAL = {\n DOM, PLATFORM, FEATURE\n };\n return global;\n}\n\nexport function reset(window?: Window) {\n if (window) {\n window.close();\n }\n\n MutationNotifier.getInstance().destruct();\n}"],"sourceRoot":"../src/"} \ No newline at end of file +{"version":3,"sources":["index.ts"],"names":[],"mappings":";AAAA,2CAA2C;;AAE3C,6CAAmF;AACnF,6DAAgD;AAChD,qEAAiE;AAEjE,2DAAyD;AAAhD,iDAAA,iBAAiB,CAAA;AAE1B;;EAEE;AACF;IACE,IAAI,2BAAa,EAAE;QACjB,OAAO;KACR;IAED,IAAI,GAAG,GAAG,6BAAQ,EAAE,CAAC;IAErB,2BAAa,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QACvC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEpE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAE1D,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,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G,sBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;IACjD,MAAM,CAAC,qBAAqB,GAAG,sBAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC;IACrE,MAAM,CAAC,QAAQ,GAAG,sBAAQ,CAAC,QAAQ,CAAC;IACpC,MAAM,CAAC,OAAO,GAAG,sBAAQ,CAAC,OAAO,CAAC;IAClC,MAAM,CAAC,MAAM,GAAG;QACd,MAAM,CAAC,QAAgB;YACrB,IAAI;gBACF,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3C;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aAC1B;QACH,CAAC;KACF,CAAC;IACF,MAAM,CAAC,GAAG,GAAG;QACX,GAAG,EAAH,iBAAG,EAAE,QAAQ,EAAR,sBAAQ,EAAE,OAAO,EAAP,qBAAO;KACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAxBD,8BAwBC;AAED,eAAsB,MAAe;IACnC,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,KAAK,EAAE,CAAC;KAChB;IAED,oCAAgB,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC;AAC5C,CAAC;AAND,sBAMC","file":"index.js","sourcesContent":["/// \n\nimport { initializePAL, DOM, PLATFORM, FEATURE, isInitialized } from 'aurelia-pal';\nimport { buildPal } from './nodejs-pal-builder';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\nexport { ensurePerformance } from './nodejs-pal-builder';\n\n/**\n* Initializes the PAL with the NodeJS-targeted implementation.\n*/\nexport function initialize(): void {\n if (isInitialized) {\n return;\n }\n\n let pal = buildPal();\n\n initializePAL((platform, feature, dom) => {\n Object.assign(platform, pal.platform);\n Object.setPrototypeOf(platform, pal.platform.constructor.prototype);\n\n Object.assign(dom, pal.dom);\n Object.setPrototypeOf(dom, pal.dom.constructor.prototype);\n\n Object.assign(feature, pal.feature);\n Object.setPrototypeOf(feature, pal.feature.constructor.prototype);\n\n (function (global) {\n global.console = global.console || {};\n let con = global.console;\n let prop;\n let method;\n let empty = {};\n let dummy = function () { };\n let properties = 'memory'.split(',');\n let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +\n 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +\n 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');\n while (prop = properties.pop()) if (!con[prop]) con[prop] = empty;\n while (method = methods.pop()) if (!con[method]) con[method] = dummy;\n })(platform.global);\n\n if (platform.global.console && typeof console.log === 'object') {\n if (typeof console['debug'] === 'undefined') {\n console['debug'] = this.bind(console['log'], console);\n }\n ['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) {\n console[method] = this.bind(console[method], console);\n }, Function.prototype.call);\n }\n\n Object.defineProperty(dom, 'title', {\n get: function () {\n return pal.global.document.title;\n },\n set: function (value) {\n pal.global.document.title = value;\n }\n });\n\n Object.defineProperty(dom, 'activeElement', {\n get: function () {\n return pal.global.document.activeElement;\n }\n });\n\n Object.defineProperty(platform, 'XMLHttpRequest', {\n get: function () {\n return pal.global.XMLHttpRequest;\n }\n });\n });\n}\n\n/**\n * @description initializes and makes variables like 'window' into NodeJS globals\n */\nexport function globalize() {\n initialize();\n global.window = global.self = PLATFORM.global;\n global.document = PLATFORM.global.document;\n global.Element = DOM.Element;\n global.NodeList = PLATFORM.global.NodeList;\n global.SVGElement = DOM.SVGElement;\n global.HTMLElement = PLATFORM.global.HTMLElement;\n global.requestAnimationFrame = PLATFORM.global.requestAnimationFrame;\n global.location = PLATFORM.location;\n global.history = PLATFORM.history;\n global.System = {\n import(moduleId: string) {\n try {\n return Promise.resolve(require(moduleId));\n } catch (e) {\n return Promise.reject(e);\n }\n }\n };\n global.PAL = {\n DOM, PLATFORM, FEATURE\n };\n return global;\n}\n\nexport function reset(window?: Window) {\n if (window) {\n window.close();\n }\n\n MutationNotifier.getInstance().destruct();\n}"],"sourceRoot":"../src/"} \ No newline at end of file diff --git a/dist/nodejs-pal-builder.d.ts b/dist/nodejs-pal-builder.d.ts index 20b280c..b246b67 100644 --- a/dist/nodejs-pal-builder.d.ts +++ b/dist/nodejs-pal-builder.d.ts @@ -8,3 +8,4 @@ export declare function buildPal(): { dom: IDom; feature: IFeature; }; +export declare function ensurePerformance(window: any): void; diff --git a/dist/nodejs-pal-builder.js b/dist/nodejs-pal-builder.js index 57d2887..5f71be6 100644 --- a/dist/nodejs-pal-builder.js +++ b/dist/nodejs-pal-builder.js @@ -68,7 +68,6 @@ function patchNotifyChange(window) { intersectMethod(element_proto, "removeAttributeNS", notify); } function ensurePerformance(window) { - const startOffset = Date.now ? Date.now() : +(new Date); const _entries = []; const _marksIndex = {}; function _filterEntries(key, value) { @@ -144,6 +143,7 @@ function ensurePerformance(window) { }; } } +exports.ensurePerformance = ensurePerformance; function ensureMutationObserver(window) { if (!window.MutationObserver) { window.MutationObserver = mutation_observer_1.MutationObserver; diff --git a/dist/nodejs-pal-builder.js.map b/dist/nodejs-pal-builder.js.map index a69a67f..8db877c 100644 --- a/dist/nodejs-pal-builder.js.map +++ b/dist/nodejs-pal-builder.js.map @@ -1 +1 @@ -{"version":3,"sources":["nodejs-pal-builder.ts"],"names":[],"mappings":";;AAKA,uDAAmD;AACnD,qDAAiD;AACjD,6CAAyC;AACzC,iCAA8B;AAC9B,qEAAiE;AACjE,qEAAiE;AAEjE,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;IACE,IAAI,KAAK,GAAG,IAAI,aAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,MAAM,GAAqB,KAAK,CAAC,MAAM,CAAC;IAE5C,IAAI,CAAC,aAAa,EAAE;QAClB,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,aAAa,GAAG,IAAI,CAAC;KACtB;IAED,iBAAiB,CAAC,MAAM,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;QACxC,MAAM,CAAC,WAAW,CAAC,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,sBAAsB,IAAI,UAAU,IAAI;YAC/F,OAAO,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC;KACH;IAGD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE;QAClC,MAAM,CAAC,WAAW,CAAC,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,gBAAgB,IAAI,UAAU,IAAI;YACnF,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC;KACH;IAGD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE;QACrC,MAAM,CAAC,WAAW,CAAC,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,mBAAmB,IAAI,UAAU,IAAI;YACzF,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC;KACH;AACH,CAAC;AAED,gCAAgC,MAAM;IACpC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC5B,MAAM,CAAC,gBAAgB,GAAG,oCAAgB,CAAC;KAC5C;AACH,CAAC","file":"nodejs-pal-builder.js","sourcesContent":["import { initializePAL } from 'aurelia-pal';\nimport { IPlatform } from './platform';\nimport { IGlobal } from './global';\nimport { IDom } from './dom';\nimport { IFeature } from './feature';\nimport { NodeJsPlatform } from './nodejs-platform';\nimport { NodeJsFeature } from './nodejs-feature';\nimport { NodeJsDom } from './nodejs-dom';\nimport { JSDOM } from 'jsdom';\nimport { MutationObserver } from './polyfills/mutation-observer';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\nlet _patchedjsdom = false;\n\nexport function buildPal(): { global: IGlobal, platform: IPlatform, dom: IDom, feature: IFeature } {\n var jsdom = new JSDOM(undefined, {});\n var global: IGlobal = jsdom.window;\n\n if (!_patchedjsdom) {\n patchNotifyChange(global);\n _patchedjsdom = true;\n }\n\n ensurePerformance(global.window);\n ensureMutationObserver(global.window);\n\n var platform = new NodeJsPlatform(global, jsdom);\n var dom = new NodeJsDom(global);\n var feature = new NodeJsFeature(global);\n\n return {\n global: global,\n platform: platform,\n dom: dom,\n feature: feature\n };\n}\n\nlet intersectSetter = function (proto, propertyName: string, intersect: Function) {\n let old = Object.getOwnPropertyDescriptor(proto, propertyName);\n let oldSet = old.set;\n let newSet = function set(V) {\n oldSet.call(this, V);\n intersect(this);\n };\n Object.defineProperty(proto, propertyName, {\n set: newSet,\n get: old.get,\n configurable: old.configurable,\n enumerable: old.enumerable\n });\n};\n\nlet intersectMethod = function (proto, methodName: string, intersect: Function) {\n let orig = proto[methodName];\n proto[methodName] = function (...args) {\n var ret = orig.apply(this, args);\n intersect(this);\n return ret;\n };\n};\n\nfunction patchNotifyChange(window: Window) {\n let notifyInstance = MutationNotifier.getInstance();\n let notify = function (node: Node) { notifyInstance.notifyChanged(node); };\n\n let node_proto = (window)._core.Node.prototype;\n\n intersectMethod(node_proto, \"appendChild\", notify);\n intersectMethod(node_proto, \"insertBefore\", notify);\n intersectMethod(node_proto, \"removeChild\", notify);\n intersectMethod(node_proto, \"replaceChild\", notify);\n intersectSetter(node_proto, \"nodeValue\", notify);\n intersectSetter(node_proto, \"textContent\", notify);\n\n let char_proto = (window)._core.CharacterData.prototype;\n\n intersectSetter(char_proto, \"data\", notify);\n\n let element_proto = (window)._core.Element.prototype;\n\n intersectMethod(element_proto, \"setAttribute\", notify);\n intersectMethod(element_proto, \"removeAttribute\", notify);\n intersectMethod(element_proto, \"removeAttributeNode\", notify);\n intersectMethod(element_proto, \"removeAttributeNS\", notify);\n}\n\n\nfunction ensurePerformance(window) {\n const startOffset = Date.now ? Date.now() : + (new Date);\n const _entries = [];\n const _marksIndex = {};\n\n function _filterEntries(key, value) {\n var i = 0, n = _entries.length, result = [];\n for (; i < n; i++) {\n if (_entries[i][key] == value) {\n result.push(_entries[i]);\n }\n }\n return result;\n }\n\n function _clearEntries(type, name) {\n var i = _entries.length, entry;\n while (i--) {\n entry = _entries[i];\n if (entry.entryType == type && (name === void 0 || entry.name == name)) {\n _entries.splice(i, 1);\n }\n }\n };\n\n if (window.performance === undefined) {\n window.performance = {};\n }\n\n if (window.performance.now === undefined) {\n let nowOffset = Date.now();\n\n window.performance.now = function now() {\n return Date.now() - nowOffset;\n };\n }\n\n if (!window.performance.mark) {\n window.performance.mark = window.performance.webkitMark || function (name) {\n const mark = {\n name,\n entryType: \"mark\",\n startTime: window.performance.now(),\n duration: 0\n };\n\n _entries.push(mark);\n _marksIndex[name] = mark;\n };\n }\n\n\n if (!window.performance.measure) {\n window.performance.measure = window.performance.webkitMeasure || function (name, startMark, endMark) {\n startMark = _marksIndex[startMark].startTime;\n endMark = _marksIndex[endMark].startTime;\n\n _entries.push({\n name,\n entryType: \"measure\",\n startTime: startMark,\n duration: endMark - startMark\n });\n };\n }\n\n\n if (!window.performance.getEntriesByType) {\n window.performance.getEntriesByType = window.performance.webkitGetEntriesByType || function (type) {\n return _filterEntries(\"entryType\", type);\n };\n }\n\n\n if (!window.performance.getEntriesByName) {\n window.performance.getEntriesByName = window.performance.webkitGetEntriesByName || function (name) {\n return _filterEntries(\"name\", name);\n };\n }\n\n\n if (!window.performance.clearMarks) {\n window.performance.clearMarks = window.performance.webkitClearMarks || function (name) {\n _clearEntries(\"mark\", name);\n };\n }\n\n\n if (!window.performance.clearMeasures) {\n window.performance.clearMeasures = window.performance.webkitClearMeasures || function (name) {\n _clearEntries(\"measure\", name);\n };\n }\n}\n\nfunction ensureMutationObserver(window) {\n if (!window.MutationObserver) {\n window.MutationObserver = MutationObserver;\n }\n}\n"],"sourceRoot":"../src/"} \ No newline at end of file +{"version":3,"sources":["nodejs-pal-builder.ts"],"names":[],"mappings":";;AAKA,uDAAmD;AACnD,qDAAiD;AACjD,6CAAyC;AACzC,iCAA8B;AAC9B,qEAAiE;AACjE,qEAAiE;AAEjE,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;IACE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WAAW,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC,CAAC;KACH;IAGD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,EAAE;QACxC,MAAM,CAAC,WAAW,CAAC,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,sBAAsB,IAAI,UAAU,IAAI;YAC/F,OAAO,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC;KACH;IAGD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE;QAClC,MAAM,CAAC,WAAW,CAAC,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,gBAAgB,IAAI,UAAU,IAAI;YACnF,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC;KACH;IAGD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE;QACrC,MAAM,CAAC,WAAW,CAAC,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,mBAAmB,IAAI,UAAU,IAAI;YACzF,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC;KACH;AACH,CAAC;AA5FD,8CA4FC;AAED,gCAAgC,MAAM;IACpC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC5B,MAAM,CAAC,gBAAgB,GAAG,oCAAgB,CAAC;KAC5C;AACH,CAAC","file":"nodejs-pal-builder.js","sourcesContent":["import { initializePAL } from 'aurelia-pal';\nimport { IPlatform } from './platform';\nimport { IGlobal } from './global';\nimport { IDom } from './dom';\nimport { IFeature } from './feature';\nimport { NodeJsPlatform } from './nodejs-platform';\nimport { NodeJsFeature } from './nodejs-feature';\nimport { NodeJsDom } from './nodejs-dom';\nimport { JSDOM } from 'jsdom';\nimport { MutationObserver } from './polyfills/mutation-observer';\nimport { MutationNotifier } from './polyfills/mutation-observer';\n\nlet _patchedjsdom = false;\n\nexport function buildPal(): { global: IGlobal, platform: IPlatform, dom: IDom, feature: IFeature } {\n var jsdom = new JSDOM(undefined, {});\n var global: IGlobal = jsdom.window;\n\n if (!_patchedjsdom) {\n patchNotifyChange(global);\n _patchedjsdom = true;\n }\n\n ensurePerformance(global.window);\n ensureMutationObserver(global.window);\n\n var platform = new NodeJsPlatform(global, jsdom);\n var dom = new NodeJsDom(global);\n var feature = new NodeJsFeature(global);\n\n return {\n global: global,\n platform: platform,\n dom: dom,\n feature: feature\n };\n}\n\nlet intersectSetter = function (proto, propertyName: string, intersect: Function) {\n let old = Object.getOwnPropertyDescriptor(proto, propertyName);\n let oldSet = old.set;\n let newSet = function set(V) {\n oldSet.call(this, V);\n intersect(this);\n };\n Object.defineProperty(proto, propertyName, {\n set: newSet,\n get: old.get,\n configurable: old.configurable,\n enumerable: old.enumerable\n });\n};\n\nlet intersectMethod = function (proto, methodName: string, intersect: Function) {\n let orig = proto[methodName];\n proto[methodName] = function (...args) {\n var ret = orig.apply(this, args);\n intersect(this);\n return ret;\n };\n};\n\nfunction patchNotifyChange(window: Window) {\n let notifyInstance = MutationNotifier.getInstance();\n let notify = function (node: Node) { notifyInstance.notifyChanged(node); };\n\n let node_proto = (window)._core.Node.prototype;\n\n intersectMethod(node_proto, \"appendChild\", notify);\n intersectMethod(node_proto, \"insertBefore\", notify);\n intersectMethod(node_proto, \"removeChild\", notify);\n intersectMethod(node_proto, \"replaceChild\", notify);\n intersectSetter(node_proto, \"nodeValue\", notify);\n intersectSetter(node_proto, \"textContent\", notify);\n\n let char_proto = (window)._core.CharacterData.prototype;\n\n intersectSetter(char_proto, \"data\", notify);\n\n let element_proto = (window)._core.Element.prototype;\n\n intersectMethod(element_proto, \"setAttribute\", notify);\n intersectMethod(element_proto, \"removeAttribute\", notify);\n intersectMethod(element_proto, \"removeAttributeNode\", notify);\n intersectMethod(element_proto, \"removeAttributeNS\", notify);\n}\n\n\nexport function ensurePerformance(window) {\n const _entries = [];\n const _marksIndex = {};\n\n function _filterEntries(key, value) {\n var i = 0, n = _entries.length, result = [];\n for (; i < n; i++) {\n if (_entries[i][key] == value) {\n result.push(_entries[i]);\n }\n }\n return result;\n }\n\n function _clearEntries(type, name) {\n var i = _entries.length, entry;\n while (i--) {\n entry = _entries[i];\n if (entry.entryType == type && (name === void 0 || entry.name == name)) {\n _entries.splice(i, 1);\n }\n }\n };\n\n if (window.performance === undefined) {\n window.performance = {};\n }\n\n if (window.performance.now === undefined) {\n let nowOffset = Date.now();\n\n window.performance.now = function now() {\n return Date.now() - nowOffset;\n };\n }\n\n if (!window.performance.mark) {\n window.performance.mark = window.performance.webkitMark || function (name) {\n const mark = {\n name,\n entryType: \"mark\",\n startTime: window.performance.now(),\n duration: 0\n };\n\n _entries.push(mark);\n _marksIndex[name] = mark;\n };\n }\n\n\n if (!window.performance.measure) {\n window.performance.measure = window.performance.webkitMeasure || function (name, startMark, endMark) {\n startMark = _marksIndex[startMark].startTime;\n endMark = _marksIndex[endMark].startTime;\n\n _entries.push({\n name,\n entryType: \"measure\",\n startTime: startMark,\n duration: endMark - startMark\n });\n };\n }\n\n\n if (!window.performance.getEntriesByType) {\n window.performance.getEntriesByType = window.performance.webkitGetEntriesByType || function (type) {\n return _filterEntries(\"entryType\", type);\n };\n }\n\n\n if (!window.performance.getEntriesByName) {\n window.performance.getEntriesByName = window.performance.webkitGetEntriesByName || function (name) {\n return _filterEntries(\"name\", name);\n };\n }\n\n\n if (!window.performance.clearMarks) {\n window.performance.clearMarks = window.performance.webkitClearMarks || function (name) {\n _clearEntries(\"mark\", name);\n };\n }\n\n\n if (!window.performance.clearMeasures) {\n window.performance.clearMeasures = window.performance.webkitClearMeasures || function (name) {\n _clearEntries(\"measure\", name);\n };\n }\n}\n\nfunction ensureMutationObserver(window) {\n if (!window.MutationObserver) {\n window.MutationObserver = MutationObserver;\n }\n}\n"],"sourceRoot":"../src/"} \ No newline at end of file diff --git a/package.json b/package.json index fa7070a..d21dae3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-pal-nodejs", - "version": "1.1.1", + "version": "1.2.0", "description": "The Node.js-specific implementation of Aurelia's platform abstraction layer.", "keywords": [ "aurelia",