From 7d254516700a2e966c792ba214eab320d0bd0813 Mon Sep 17 00:00:00 2001 From: Tim Branyen Date: Sun, 2 May 2021 18:46:07 -0700 Subject: [PATCH 1/3] Fix issues with middleware --- packages/diffhtml-components/lib/component.js | 8 +++--- .../diffhtml-components/lib/util/types.js | 1 + .../build/tasks/browserify.coffee | 2 +- .../chrome-extension/manifest.json | 1 + packages/diffhtml-devtools/demo/index.html | 4 +-- .../lib/scripts/background.js | 8 +++--- .../diffhtml-devtools/lib/scripts/bridge.js | 15 +++++------ .../scripts/components/transaction-detail.js | 8 +++--- .../lib/scripts/components/transaction-row.js | 16 +++++------ .../lib/scripts/components/vtree.js | 4 +-- .../diffhtml-devtools/lib/scripts/index.js | 14 ++++++---- .../diffhtml-devtools/lib/scripts/injector.js | 1 + .../lib/scripts/panels/health.js | 6 ++--- .../lib/scripts/panels/help.js | 8 +++--- .../lib/scripts/panels/middleware.js | 6 ++--- .../lib/scripts/panels/mounts.js | 10 +++---- .../lib/scripts/panels/transactions.js | 16 +++++------ packages/diffhtml-devtools/package.json | 9 +++++++ .../diffhtml-middleware-logger/lib/index.js | 9 ++++--- .../lib/index.js | 5 +++- packages/diffhtml/lib/tasks/should-update.js | 5 +--- packages/diffhtml/lib/transaction.js | 2 +- packages/diffhtml/lib/util/types.js | 1 - packages/diffhtml/test/use.js | 27 ++++++++++++++++++- 24 files changed, 113 insertions(+), 73 deletions(-) diff --git a/packages/diffhtml-components/lib/component.js b/packages/diffhtml-components/lib/component.js index ca8c50a9..3faaf4b0 100644 --- a/packages/diffhtml-components/lib/component.js +++ b/packages/diffhtml-components/lib/component.js @@ -19,8 +19,10 @@ const RenderDebounce = new WeakMap(); /** * @param {Props} defaultProps + * @returns {string[]} */ -const getObserved = ({ defaultProps }) => defaultProps ? keys(defaultProps) : []; +const getObserved = ({ defaultProps }) => + defaultProps ? keys(defaultProps) : EMPTY.ARR; /** * Creates the `component.props` object. @@ -210,8 +212,6 @@ export default class Component { this[$$render]()?.then(resolve); }))); } - - return RenderDebounce.get(this); } /** @type {State} */ @@ -440,4 +440,4 @@ try { } catch {} // Automatically subscribe the Component middleware. -Component.subscribeMiddleware(); \ No newline at end of file +Component.subscribeMiddleware(); diff --git a/packages/diffhtml-components/lib/util/types.js b/packages/diffhtml-components/lib/util/types.js index d7b73cb7..301e3ec0 100644 --- a/packages/diffhtml-components/lib/util/types.js +++ b/packages/diffhtml-components/lib/util/types.js @@ -3,6 +3,7 @@ */ export const EMPTY = { OBJ: {}, + ARR: [], BOOL: true, }; diff --git a/packages/diffhtml-devtools/build/tasks/browserify.coffee b/packages/diffhtml-devtools/build/tasks/browserify.coffee index 38ccb1b2..426b2c1d 100644 --- a/packages/diffhtml-devtools/build/tasks/browserify.coffee +++ b/packages/diffhtml-devtools/build/tasks/browserify.coffee @@ -24,7 +24,7 @@ module.exports = -> transform: [ 'babelify', 'brfs', - ["aliasify", { global: true }] + 'aliasify', ] exclude: ['fs'] diff --git a/packages/diffhtml-devtools/chrome-extension/manifest.json b/packages/diffhtml-devtools/chrome-extension/manifest.json index 6b81cb77..f31d765e 100644 --- a/packages/diffhtml-devtools/chrome-extension/manifest.json +++ b/packages/diffhtml-devtools/chrome-extension/manifest.json @@ -4,6 +4,7 @@ "description": "Official diffHTML Chrome DevTools Extension", "permissions": [ "tabs", + "*://*/*", "http://*/*", "https://*/*" ], diff --git a/packages/diffhtml-devtools/demo/index.html b/packages/diffhtml-devtools/demo/index.html index f7fb00b4..5ae8ad2b 100644 --- a/packages/diffhtml-devtools/demo/index.html +++ b/packages/diffhtml-devtools/demo/index.html @@ -18,8 +18,8 @@ const { use, html, innerHTML, outerHTML } = diff; // Current broken and not letting text update for some reason... - //use(inlineTransitions()); - //use(logger()); + use(inlineTransitions()); + use(logger()); const animate = (el, ...args) => new Promise(resolve => el.animate( ...args diff --git a/packages/diffhtml-devtools/lib/scripts/background.js b/packages/diffhtml-devtools/lib/scripts/background.js index 29b39c22..16bfddc5 100644 --- a/packages/diffhtml-devtools/lib/scripts/background.js +++ b/packages/diffhtml-devtools/lib/scripts/background.js @@ -5,10 +5,10 @@ const savedRequests = []; chrome.runtime.onConnect.addListener(port => { if (port.name === 'devtools-page') { - const devToolsListener = function(message, sender, sendResponse) { + const devToolsListener = message => { connections.set(message.tabId, port); - savedRequests.forEach(function([id, request]) { + savedRequests.forEach(([id, request]) => { connections.get(id).postMessage(request); }); @@ -23,7 +23,7 @@ chrome.runtime.onConnect.addListener(port => { port.onMessage.addListener(devToolsListener); - port.onDisconnect.addListener(function(port) { + port.onDisconnect.addListener(port => { port.onMessage.removeListener(devToolsListener); connections.forEach((prevPort, tabId) => { @@ -37,7 +37,7 @@ chrome.runtime.onConnect.addListener(port => { // Receive message from content script and relay to the devTools page for the // current tab -chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { +chrome.runtime.onMessage.addListener((request, sender) => { // Messages from content scripts should have sender.tab set if (sender.tab) { const { id } = sender.tab; diff --git a/packages/diffhtml-devtools/lib/scripts/bridge.js b/packages/diffhtml-devtools/lib/scripts/bridge.js index 5675459a..490576a6 100644 --- a/packages/diffhtml-devtools/lib/scripts/bridge.js +++ b/packages/diffhtml-devtools/lib/scripts/bridge.js @@ -127,7 +127,7 @@ export default function devTools(Internals) { function devToolsTask(transaction) { const { - mount, markup, config, state: { newTree }, state + mount, markup, config, newTree, state } = transaction; const isFunction = typeof mount.rawNodeName === 'function'; @@ -136,9 +136,12 @@ export default function devTools(Internals) { const startDate = performance.now(); const start = () => { - console.log('Start transaction'); + selectors.set(selector, newTree); + + extension.activate(getInternals()); + return extension.startTransaction(startDate, { - domNode: selector, + mount: selector, markup, options: config, state: assign({}, state, state.nextTransaction && { @@ -156,8 +159,6 @@ export default function devTools(Internals) { start(); } - selectors.set(selector, newTree); - return function() { // TODO Make patches a separate asynchronous operation, and only // aggregate when completed. @@ -172,7 +173,7 @@ export default function devTools(Internals) { const { aborted, completed } = transaction; const stop = () => extension.endTransaction(startDate, endDate, { - domNode: selector, + mount: selector, markup, options: config, state: assign({}, state, state.nextTransaction && { @@ -189,8 +190,6 @@ export default function devTools(Internals) { if (!extension) { cacheTask.push(() => stop()); } else { - - extension.activate(getInternals()); stop(); } }); diff --git a/packages/diffhtml-devtools/lib/scripts/components/transaction-detail.js b/packages/diffhtml-devtools/lib/scripts/components/transaction-detail.js index c872926a..0df6e9d7 100644 --- a/packages/diffhtml-devtools/lib/scripts/components/transaction-detail.js +++ b/packages/diffhtml-devtools/lib/scripts/components/transaction-detail.js @@ -2,10 +2,10 @@ import { html } from 'diffhtml'; import { Component } from 'diffhtml-components'; class DevtoolsTransactionDetail extends Component { - static propTypes = { - transaction: Object, - stats: Object, - closeDetail: Function, + static defaultProps = { + transaction: {}, + stats: {}, + closeDetail: () => {}, } state = { diff --git a/packages/diffhtml-devtools/lib/scripts/components/transaction-row.js b/packages/diffhtml-devtools/lib/scripts/components/transaction-row.js index b7bffe8e..0b9b0f45 100644 --- a/packages/diffhtml-devtools/lib/scripts/components/transaction-row.js +++ b/packages/diffhtml-devtools/lib/scripts/components/transaction-row.js @@ -5,12 +5,12 @@ import SemanticUITable from '../semantic-ui/table'; const { keys } = Object; class DevtoolsTransactionRow extends Component { - static propTypes = { - index: Number, - transaction: Object, - stateName: String, - startTime: Number, - endTime: Number, + static defaultProps = { + index: -1, + transaction: {}, + stateName: '', + startTime: -1, + endTime: -1, } render() { @@ -25,7 +25,7 @@ class DevtoolsTransactionRow extends Component { const stats = this.calculateStats(); const { - domNode = '', + mount = '', aborted = false, promises = [], } = transaction; @@ -68,7 +68,7 @@ class DevtoolsTransactionRow extends Component {
- <${domNode}> + <${mount}>
diff --git a/packages/diffhtml-devtools/lib/scripts/components/vtree.js b/packages/diffhtml-devtools/lib/scripts/components/vtree.js index 7d5f4129..029d7757 100644 --- a/packages/diffhtml-devtools/lib/scripts/components/vtree.js +++ b/packages/diffhtml-devtools/lib/scripts/components/vtree.js @@ -5,8 +5,8 @@ const { keys } = Object; const { stringify } = JSON; class DevtoolsVTree extends Component { - static propTypes = { - vTree: Object, + static defaultProps = { + vTree: {}, } state = { diff --git a/packages/diffhtml-devtools/lib/scripts/index.js b/packages/diffhtml-devtools/lib/scripts/index.js index e1c7a09d..16f4827b 100644 --- a/packages/diffhtml-devtools/lib/scripts/index.js +++ b/packages/diffhtml-devtools/lib/scripts/index.js @@ -1,5 +1,6 @@ import { outerHTML, html, use } from 'diffhtml'; import inlineTransitions from 'diffhtml-middleware-inline-transitions'; +import syntheticEvents from 'diffhtml-middleware-synthetic-events'; // Components import './components/panels'; @@ -22,7 +23,8 @@ const { stringify, parse } = JSON; const { assign } = Object; const background = chrome.runtime.connect({ name: 'devtools-page' }); -//use(inlineTransitions()); +use(inlineTransitions()); +use(syntheticEvents()); use({ // When dark mode is set, automatically add Semantic UI `inverted` class. @@ -90,7 +92,8 @@ const fadeIn = el => { }); }; -const render = () => outerHTML(main, html`
+const render = () => outerHTML(main, html` +
${Boolean(state.version) && html` outerHTML(main, html`
-
`).catch(ex => { +
+`).catch(ex => { throw ex; }); @@ -159,8 +163,6 @@ background.onMessage.addListener(unparsedMessage => { case 'activated': { const clonedData = clone(message.data); - console.log(clonedData); - assign(state, { ...clonedData, inProgress: clonedData.inProgress || state.inProgress, @@ -168,6 +170,8 @@ background.onMessage.addListener(unparsedMessage => { memory: state.memory.concat(clonedData.memory).filter(Boolean).slice(-1), }); + console.log('mounts', state.mounts); + break; } diff --git a/packages/diffhtml-devtools/lib/scripts/injector.js b/packages/diffhtml-devtools/lib/scripts/injector.js index 0af4e18c..45137bf9 100644 --- a/packages/diffhtml-devtools/lib/scripts/injector.js +++ b/packages/diffhtml-devtools/lib/scripts/injector.js @@ -13,6 +13,7 @@ if (!window.__diffHTMLDevTools) { window.__diffHTMLDevTools = () => ({ activate(args={}) { triggerEvent('activated', args); + this.activated = true; return this; }, diff --git a/packages/diffhtml-devtools/lib/scripts/panels/health.js b/packages/diffhtml-devtools/lib/scripts/panels/health.js index c03882a3..53396a99 100644 --- a/packages/diffhtml-devtools/lib/scripts/panels/health.js +++ b/packages/diffhtml-devtools/lib/scripts/panels/health.js @@ -4,9 +4,9 @@ import { Component } from 'diffhtml-components'; //import ChartistGraph from 'react-chartist'; class DevtoolsHealthPanel extends Component { - static propTypes = { - activeRoute: String, - memory: Array, + static defaultProps = { + activeRoute: '', + memory: [], } state = { diff --git a/packages/diffhtml-devtools/lib/scripts/panels/help.js b/packages/diffhtml-devtools/lib/scripts/panels/help.js index 2582b3e3..6630d86c 100644 --- a/packages/diffhtml-devtools/lib/scripts/panels/help.js +++ b/packages/diffhtml-devtools/lib/scripts/panels/help.js @@ -2,10 +2,10 @@ import diff, { html } from 'diffhtml'; import { Component } from 'diffhtml-components'; class DevtoolsHelpPanel extends Component { - static propTypes = { - theme: String, - activeRoute: String, - version: Number, + static defaultProps = { + theme: '', + activeRoute: '', + version: -1, } state = { diff --git a/packages/diffhtml-devtools/lib/scripts/panels/middleware.js b/packages/diffhtml-devtools/lib/scripts/panels/middleware.js index 190c80ee..e2e0da82 100644 --- a/packages/diffhtml-devtools/lib/scripts/panels/middleware.js +++ b/packages/diffhtml-devtools/lib/scripts/panels/middleware.js @@ -2,9 +2,9 @@ import { html } from 'diffhtml'; import { Component } from 'diffhtml-components'; class DevtoolsMiddlewarePanel extends Component { - static propTypes = { - activeRoute: String, - middleware: Array, + static defaultProps = { + activeRoute: '', + middleware: [], } state = { diff --git a/packages/diffhtml-devtools/lib/scripts/panels/mounts.js b/packages/diffhtml-devtools/lib/scripts/panels/mounts.js index 3f412088..fae38ab2 100644 --- a/packages/diffhtml-devtools/lib/scripts/panels/mounts.js +++ b/packages/diffhtml-devtools/lib/scripts/panels/mounts.js @@ -2,10 +2,10 @@ import { html } from 'diffhtml'; import { Component } from 'diffhtml-components'; class DevtoolsMountsPanel extends Component { - static propTypes = { - mounts: Array, - inspect: Function, - activeRoute: String, + static defaultProps = { + mounts: [], + inspect: () => {}, + activeRoute: '', } state = { @@ -28,7 +28,7 @@ class DevtoolsMountsPanel extends Component {
-

this.setState({ isExpanded: !isExpanded })}> +

this.setState({ isExpanded: !isExpanded })}> Mounts

diff --git a/packages/diffhtml-devtools/lib/scripts/panels/transactions.js b/packages/diffhtml-devtools/lib/scripts/panels/transactions.js index b5277a1c..1fb4a828 100644 --- a/packages/diffhtml-devtools/lib/scripts/panels/transactions.js +++ b/packages/diffhtml-devtools/lib/scripts/panels/transactions.js @@ -2,11 +2,11 @@ import { html } from 'diffhtml'; import { Component } from 'diffhtml-components'; class DevtoolsTransactionsPanel extends Component { - static propTypes = { - inProgress: Array, - completed: Array, - inspect: Function, - activeRoute: String, + static defaultProps = { + inProgress: [], + completed: [], + inspect: () => {}, + activeRoute: '', } state = { @@ -20,7 +20,7 @@ class DevtoolsTransactionsPanel extends Component { } render() { - const { clearEntries, inProgress, completed } = this.props; + const { clearEntries } = this.props; const { isExpanded, autoScroll, @@ -28,7 +28,7 @@ class DevtoolsTransactionsPanel extends Component { activeTransaction, sorted, } = this.state; - const { fragment, toggleAutoscroll, toggleHideEmpty } = this; + const { toggleAutoscroll, toggleHideEmpty } = this; return html` @@ -286,7 +286,7 @@ class DevtoolsTransactionsPanel extends Component { } componentDidUpdate() { - const { isExpanded, expandedIndex, autoScroll } = this.state; + const { expandedIndex, autoScroll } = this.state; // TODO Have more intelligent locking for scrolling. if (expandedIndex === -1 && autoScroll) { diff --git a/packages/diffhtml-devtools/package.json b/packages/diffhtml-devtools/package.json index 74200983..3b62c560 100644 --- a/packages/diffhtml-devtools/package.json +++ b/packages/diffhtml-devtools/package.json @@ -2,6 +2,9 @@ "name": "diffhtml-devtools", "private": true, "main": "module/devtools.es5.js", + "scripts": { + "build": "grunt" + }, "devDependencies": { "@babel/core": "^7.12.10", "@babel/plugin-proposal-class-properties": "^7.12.1", @@ -12,6 +15,7 @@ "aliasify": "^2.1.0", "babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-transform-custom-element-classes": "^0.1.0", + "babel-plugin-transform-diffhtml": "^1.0.0-beta.18", "babel-plugin-transform-react-jsx": "^6.24.1", "babel-preset-es2015": "^6.24.1", "babelify": "^10.0.0", @@ -20,6 +24,11 @@ "browserify-derequire": "^1.1.1", "coffeescript": "^2.5.1", "derequire": "^2.1.1", + "diffhtml": "^1.0.0-beta.18", + "diffhtml-components": "^1.0.0-beta.18", + "diffhtml-middleware-inline-transitions": "^1.0.0-beta.18", + "diffhtml-middleware-synthetic-events": "^1.0.0-beta.18", + "diffhtml-react-compat": "^1.0.0-beta.18", "es6-module-loader": "^0.17.11", "es6-module-transpiler": "^0.10.0", "grunt": "^1.3.0", diff --git a/packages/diffhtml-middleware-logger/lib/index.js b/packages/diffhtml-middleware-logger/lib/index.js index d2e523d8..8f04e971 100644 --- a/packages/diffhtml-middleware-logger/lib/index.js +++ b/packages/diffhtml-middleware-logger/lib/index.js @@ -182,7 +182,7 @@ const log = (message, method, color, _date, transaction, completed) => { } if (!completed && mount) { - console.log('%cdomNode %O', 'font-weight: bold; color: #868686', mount); + console.log('%cmount %O', 'font-weight: bold; color: #868686', mount); } if (!completed && input) { @@ -234,11 +234,11 @@ const log = (message, method, color, _date, transaction, completed) => { const logger = ({ minimize = false }) => assign(function loggerTask(transaction) { const start = new Date(); - const { domNode } = transaction; - const name = domNode.name || domNode.displayName || domNode.nodeName; + const { mount } = transaction; + const name = mount.name || mount.displayName || mount.nodeName; log( - `%c<${transaction.domNode.nodeName}> render started `, + `%c<${transaction.mount.nodeName}> render started `, 'groupCollapsed', 'color: #FF0066', start, @@ -259,6 +259,7 @@ const logger = ({ minimize = false }) => assign(function loggerTask(transaction) ); console.groupEnd(); + return; } transaction._cloneOldTree = oldTree && cloneTree(oldTree); diff --git a/packages/diffhtml-middleware-synthetic-events/lib/index.js b/packages/diffhtml-middleware-synthetic-events/lib/index.js index 7f0b2b3d..91dbe56f 100644 --- a/packages/diffhtml-middleware-synthetic-events/lib/index.js +++ b/packages/diffhtml-middleware-synthetic-events/lib/index.js @@ -1,4 +1,7 @@ -const { NodeCache, PATCH_TYPE, decodeEntities, createNode } = Internals; +const globalThis = typeof global === 'object' ? global : window || {}; +const binding = globalThis[Symbol.for('diffHTML')] + +const { NodeCache, PATCH_TYPE, decodeEntities, createNode } = binding.Internals; const useCapture = [ 'onload', 'onunload', 'onscroll', 'onfocus', 'onblur', 'onloadstart', diff --git a/packages/diffhtml/lib/tasks/should-update.js b/packages/diffhtml/lib/tasks/should-update.js index dd2516da..8d95a9bf 100644 --- a/packages/diffhtml/lib/tasks/should-update.js +++ b/packages/diffhtml/lib/tasks/should-update.js @@ -6,7 +6,7 @@ import Transaction from "../transaction"; * @param {Transaction} transaction */ export default function shouldUpdate(transaction) { - const { mount, input, state, state: { measure }, config: options } = transaction; + const { mount, input, state: { measure }, config: options } = transaction; const prop = options.inner ? 'innerHTML' : 'outerHTML'; measure('should update'); @@ -19,9 +19,6 @@ export default function shouldUpdate(transaction) { if (typeof input === 'string' && mountAsHTMLEl[prop]=== input) { return transaction.abort(true); } - else if (typeof input === 'string') { - state.markup = input; - } measure('should update'); } diff --git a/packages/diffhtml/lib/transaction.js b/packages/diffhtml/lib/transaction.js index b55cba64..c146ed95 100644 --- a/packages/diffhtml/lib/transaction.js +++ b/packages/diffhtml/lib/transaction.js @@ -143,7 +143,7 @@ export default class Transaction { this.tasks = /** @type {Function[]} */ ( getConfig('tasks', defaultTasks, undefined, config) - ); + ).slice(); // Store calls to trigger after the transaction has ended. this.endedCallbacks = new Set(); diff --git a/packages/diffhtml/lib/util/types.js b/packages/diffhtml/lib/util/types.js index 9a845010..b8325458 100644 --- a/packages/diffhtml/lib/util/types.js +++ b/packages/diffhtml/lib/util/types.js @@ -223,7 +223,6 @@ export const Supplemental = EMPTY.OBJ; * @property {Function} measure * @property {Set} svgElements * @property {Map} scriptsToExecute - * @property {ValidInput=} markup * @property {VTree=} oldTree * @property {Boolean=} isRendering * @property {Boolean=} isDirty diff --git a/packages/diffhtml/test/use.js b/packages/diffhtml/test/use.js index 169ade8b..569a7333 100644 --- a/packages/diffhtml/test/use.js +++ b/packages/diffhtml/test/use.js @@ -56,11 +56,36 @@ describe('Use (Middleware)', function() { it('will call unsubscribe', () => { }); + it('will inline returned functions to execute before transaction ends', () => { + const domNode = document.createElement('div'); + const span = document.createElement('span'); + + let count = 0; + + const unsubscribe = use(() => () => { + count++; + }); + + innerHTML(domNode, html` +
+ `); + + innerHTML(span, html` +
+ `); + + equal(count, 2); + + unsubscribe(); + release(domNode); + release(span); + }); + it('will allow swapping out what node gets created', () => { const domNode = document.createElement('div'); const span = document.createElement('span'); - this.createNodeHook = ({ nodeName, attributes }) => { + this.createNodeHook = ({ nodeName }) => { if (nodeName === 'div') { return span; } From d6944f3d8ac6c6a820edb18eb1f3a81852f0f150 Mon Sep 17 00:00:00 2001 From: Tim Branyen Date: Mon, 3 May 2021 10:34:18 -0700 Subject: [PATCH 2/3] Ensure inline transitions can be built --- packages/diffhtml-devtools/package.json | 10 +-- .../package.json | 76 +++++++++++-------- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/packages/diffhtml-devtools/package.json b/packages/diffhtml-devtools/package.json index 3b62c560..f3f328b9 100644 --- a/packages/diffhtml-devtools/package.json +++ b/packages/diffhtml-devtools/package.json @@ -24,11 +24,6 @@ "browserify-derequire": "^1.1.1", "coffeescript": "^2.5.1", "derequire": "^2.1.1", - "diffhtml": "^1.0.0-beta.18", - "diffhtml-components": "^1.0.0-beta.18", - "diffhtml-middleware-inline-transitions": "^1.0.0-beta.18", - "diffhtml-middleware-synthetic-events": "^1.0.0-beta.18", - "diffhtml-react-compat": "^1.0.0-beta.18", "es6-module-loader": "^0.17.11", "es6-module-transpiler": "^0.10.0", "grunt": "^1.3.0", @@ -64,6 +59,11 @@ } }, "dependencies": { + "diffhtml": "^1.0.0-beta.18", + "diffhtml-components": "^1.0.0-beta.18", + "diffhtml-middleware-inline-transitions": "^1.0.0-beta.18", + "diffhtml-middleware-synthetic-events": "^1.0.0-beta.18", + "diffhtml-react-compat": "^1.0.0-beta.18", "hyperlist": "^1.0.0", "semantic-ui-react": "^2.0.1" } diff --git a/packages/diffhtml-middleware-inline-transitions/package.json b/packages/diffhtml-middleware-inline-transitions/package.json index 14395d79..914b2c83 100644 --- a/packages/diffhtml-middleware-inline-transitions/package.json +++ b/packages/diffhtml-middleware-inline-transitions/package.json @@ -1,34 +1,46 @@ { - "name": "diffhtml-middleware-inline-transitions", - "version": "1.0.0-beta.18", - "description": "Monitors inline attributes and assigns transition hooks", - "main": "dist/cjs/index", - "module": "dist/es/index", - "jsnext:main": "dist/es/index", - "esnext:main": "dist/es/index", - "keywords": [ - "diffhtml", - "transitions" - ], - "author": "Tim Branyen (@tbranyen)", - "license": "MIT", - "devDependencies": { - "@babel/cli": "^7.12.10", - "@babel/core": "^7.12.10", - "@babel/register": "^7.12.10", - "coveralls": "^3.1.0", - "jsdom": "^16.4.0", - "mocha": "^8.2.1", - "nyc": "^15.1.0", - "rollup": "^1.21.4", - "rollup-plugin-babel": "^4.3.3", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-replace": "^2.2.0", - "rollup-plugin-visualizer": "^2.6.0", - "rollup-watch": "^4.3.1", - "uglify-js": "^3.12.4" - }, - "peerDependencies": { - "diffhtml": "^1.0.0-beta.18" - } + "name": "diffhtml-middleware-inline-transitions", + "version": "1.0.0-beta.18", + "description": "Monitors inline attributes and assigns transition hooks", + "main": "dist/cjs/index", + "module": "dist/es/index", + "jsnext:main": "dist/es/index", + "esnext:main": "dist/es/index", + "scripts": { + "prepublishOnly": "npm run min", + "clean": "rm -rf dist/* && mkdir -p dist", + "min": "npm run build && npm run build-min", + "build": "npm run clean && npm run build-umd && npm run build-cjs && npm run build-esm", + "build-cjs": "NODE_ENV=cjs babel lib -d dist/cjs", + "build-esm": "NODE_ENV=esm babel lib -d dist/es", + "build-umd": "NODE_ENV=umd rollup -c rollup.config.js", + "build-min": "NODE_ENV=min rollup -c rollup.config.js && uglifyjs dist/inline-transitions.min.js -o dist/inline-transitions.min.js -m -c", + "watch": "NODE_ENV=umd rollup -c rollup.config.js -w" + }, + "keywords": [ + "diffhtml", + "transitions" + ], + "author": "Tim Branyen (@tbranyen)", + "license": "MIT", + "devDependencies": { + "@babel/cli": "^7.12.10", + "@babel/core": "^7.12.10", + "@babel/register": "^7.12.10", + "babel-preset-diffhtml-imports": "^1.0.0-beta.18", + "coveralls": "^3.1.0", + "jsdom": "^16.4.0", + "mocha": "^8.2.1", + "nyc": "^15.1.0", + "rollup": "^1.21.4", + "rollup-plugin-babel": "^4.3.3", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-replace": "^2.2.0", + "rollup-plugin-visualizer": "^2.6.0", + "rollup-watch": "^4.3.1", + "uglify-js": "^3.12.4" + }, + "peerDependencies": { + "diffhtml": "^1.0.0-beta.18" + } } From 47d85c0e07cb7e5364c615c53bed06abaebb97ec Mon Sep 17 00:00:00 2001 From: Tim Branyen Date: Mon, 3 May 2021 10:41:33 -0700 Subject: [PATCH 3/3] Clean up --- packages/diffhtml-components/lib/component.js | 2 ++ packages/diffhtml-devtools/build/tasks/browserify.coffee | 2 +- packages/diffhtml-devtools/lib/scripts/index.js | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/diffhtml-components/lib/component.js b/packages/diffhtml-components/lib/component.js index 3faaf4b0..52cdecc3 100644 --- a/packages/diffhtml-components/lib/component.js +++ b/packages/diffhtml-components/lib/component.js @@ -212,6 +212,8 @@ export default class Component { this[$$render]()?.then(resolve); }))); } + + return RenderDebounce.get(this); } /** @type {State} */ diff --git a/packages/diffhtml-devtools/build/tasks/browserify.coffee b/packages/diffhtml-devtools/build/tasks/browserify.coffee index 426b2c1d..38ccb1b2 100644 --- a/packages/diffhtml-devtools/build/tasks/browserify.coffee +++ b/packages/diffhtml-devtools/build/tasks/browserify.coffee @@ -24,7 +24,7 @@ module.exports = -> transform: [ 'babelify', 'brfs', - 'aliasify', + ["aliasify", { global: true }] ] exclude: ['fs'] diff --git a/packages/diffhtml-devtools/lib/scripts/index.js b/packages/diffhtml-devtools/lib/scripts/index.js index 16f4827b..a3d55118 100644 --- a/packages/diffhtml-devtools/lib/scripts/index.js +++ b/packages/diffhtml-devtools/lib/scripts/index.js @@ -170,8 +170,6 @@ background.onMessage.addListener(unparsedMessage => { memory: state.memory.concat(clonedData.memory).filter(Boolean).slice(-1), }); - console.log('mounts', state.mounts); - break; }