diff --git a/packages/blaze-tools/preamble.js b/packages/blaze-tools/preamble.js index e39fe53ac..0ea86ee21 100644 --- a/packages/blaze-tools/preamble.js +++ b/packages/blaze-tools/preamble.js @@ -14,7 +14,7 @@ import { parseStringLiteral } from './tokens'; -BlazeTools = { +export const BlazeTools = { EmitCode, toJSLiteral, toObjectLiteralKey, @@ -25,5 +25,3 @@ BlazeTools = { parseExtendedIdentifierName, parseStringLiteral }; - -export { BlazeTools }; diff --git a/packages/blaze/blaze.d.ts b/packages/blaze/blaze.d.ts new file mode 100644 index 000000000..b3f72526b --- /dev/null +++ b/packages/blaze/blaze.d.ts @@ -0,0 +1,25 @@ +import { Blaze } from 'meteor/blaze'; + +export namespace Meteor { + + /** Event **/ + interface Event { + type: string; + target: HTMLElement; + currentTarget: HTMLElement; + which: number; + stopPropagation(): void; + stopImmediatePropagation(): void; + preventDefault(): void; + isPropagationStopped(): boolean; + isImmediatePropagationStopped(): boolean; + isDefaultPrevented(): boolean; + } + interface EventHandlerFunction extends Function { + (event?: Event, templateInstance?: Blaze.TemplateInstance): void; + } + interface EventMap { + [id: string]: EventHandlerFunction; + } + /** Event **/ +} diff --git a/packages/blaze/dombackend.js b/packages/blaze/dombackend.js index 361e37ae5..f8be19492 100644 --- a/packages/blaze/dombackend.js +++ b/packages/blaze/dombackend.js @@ -1,3 +1,10 @@ +// this is necessary because when esbuild chunks things (when using dynamic imports) +// it assumes that every import in that chunk is independent of each other (which is technically correct) +// however, because blaze has an implicit depedency that jquery loads first, this fails. +// this could be fixed more correctly by changing how we generate dependencies.js - but it would be brutal +// it would require that every import be alone in a file with an import to it's predecessor +import "meteor/jquery"; + var DOMBackend = {}; Blaze._DOMBackend = DOMBackend; diff --git a/packages/html-tools/main.js b/packages/html-tools/main.js index 4250fb909..fe2c12b25 100644 --- a/packages/html-tools/main.js +++ b/packages/html-tools/main.js @@ -6,7 +6,7 @@ import { Scanner } from './scanner'; import { parseFragment, codePointToString, getContent, getRCData } from './parse'; import { getComment, getDoctype, getHTMLToken, getTagToken, TEMPLATE_TAG_POSITION } from './tokenize'; -HTMLTools = { +const HTMLTools = { asciiLowerCase, properCaseTagName, properCaseAttributeName, diff --git a/packages/observe-sequence/observe_sequence.js b/packages/observe-sequence/observe_sequence.js index fd4a591c3..5fa6b5b6e 100644 --- a/packages/observe-sequence/observe_sequence.js +++ b/packages/observe-sequence/observe_sequence.js @@ -2,15 +2,6 @@ const isObject = function (value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } -const has = function (obj, key) { - var keyParts = key.split('.'); - - return !!obj && ( - keyParts.length > 1 - ? has(obj[key.split('.')[0]], keyParts.slice(1).join('.')) - : hasOwnProperty.call(obj, key) - ); -}; const warn = function () { if (ObserveSequence._suppressWarnings) { @@ -353,12 +344,12 @@ const diffArray = function (lastSeqArray, seqArray, callbacks) { prevPosition); } }); - + Object.entries(posNew).forEach(function ([idString, pos]) { var id = idParse(idString); - - if (has(posOld, idString)) { + + if (Object.hasOwnProperty.call(posOld, idString)) { // specifically for primitive types, compare equality before // firing the 'changedAt' callback. otherwise, always fire it // because doing a deep EJSON comparison is not guaranteed to diff --git a/packages/observe-sequence/package.js b/packages/observe-sequence/package.js index 934901033..60d37d642 100644 --- a/packages/observe-sequence/package.js +++ b/packages/observe-sequence/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Observe changes to various sequence types such as arrays, cursors and objects", - version: "1.0.20" + version: "1.0.21" }); Package.onUse(function (api) { diff --git a/packages/spacebars-compiler/preamble.js b/packages/spacebars-compiler/preamble.js index 447522223..053d6c3d3 100644 --- a/packages/spacebars-compiler/preamble.js +++ b/packages/spacebars-compiler/preamble.js @@ -3,7 +3,7 @@ import { optimize } from './optimizer'; import { parse, compile, codeGen, TemplateTagReplacer, beautify } from './compiler'; import { TemplateTag } from './templatetag'; -SpacebarsCompiler = { +export const SpacebarsCompiler = { CodeGen, _builtInBlockHelpers: builtInBlockHelpers, isReservedName, @@ -15,5 +15,3 @@ SpacebarsCompiler = { _beautify: beautify, TemplateTag, }; - -export { SpacebarsCompiler };