diff --git a/dist/nodejs-pal-builder.js b/dist/nodejs-pal-builder.js index ddf50e0..57d2887 100644 --- a/dist/nodejs-pal-builder.js +++ b/dist/nodejs-pal-builder.js @@ -59,6 +59,8 @@ function patchNotifyChange(window) { intersectMethod(node_proto, "replaceChild", notify); intersectSetter(node_proto, "nodeValue", notify); intersectSetter(node_proto, "textContent", notify); + let char_proto = window._core.CharacterData.prototype; + intersectSetter(char_proto, "data", notify); let element_proto = window._core.Element.prototype; intersectMethod(element_proto, "setAttribute", notify); intersectMethod(element_proto, "removeAttribute", notify); diff --git a/dist/nodejs-pal-builder.js.map b/dist/nodejs-pal-builder.js.map index 510a09a..a69a67f 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,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,QAAQ,GAAG,IAAI,gCAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACjD,IAAI,GAAG,GAAG,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,OAAO,GAAG,IAAI,8BAAa,CAAC,MAAM,CAAC,CAAC;IAExC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,QAAQ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,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 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,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,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,QAAQ,GAAG,IAAI,gCAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACjD,IAAI,GAAG,GAAG,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,OAAO,GAAG,IAAI,8BAAa,CAAC,MAAM,CA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,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 diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index f6f29b9..dba382f 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,10 @@ + +## [1.1.1](https://github.com/aurelia/pal-nodejs/compare/1.1.0...1.1.1) (2018-06-12) + +### Bug Fixes + +* **mutation-observer:** MutationObserver not handling changes to CharacterData.data + # [1.0.0-beta.3.3.0](https://github.com/aurelia/pal-nodejs/compare/1.0.0-beta.3.2.0...1.0.0-beta.3.3.0) (2018-04-17) diff --git a/package.json b/package.json index c864e56..fa7070a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-pal-nodejs", - "version": "1.1.0", + "version": "1.1.1", "description": "The Node.js-specific implementation of Aurelia's platform abstraction layer.", "keywords": [ "aurelia",