Minor Changes
-
#4782
f019ff6Thanks @DylanPiercey! - Types are stripped in one pass over the template rather than by Babel's TypeScript plugin, which is no longer bundled. Enums, namespaces and parameter properties compile natively. Enums now compile instatic,server,clientand$statements too, as namespaces did. Reads of an enum's constant members are inlined, a regular enum's as aconst enum's, and template content reads aserverorclientstatement's enum as each output does; a regular enum keeps its object for other uses, and aconst enumis removed once every member folds and every read is inlined, else is a plain object, as an exported one is. An exported namespace is initialized when the module loads rather than on its first render, and an enum or namespace a namespace exports adds to the one an earlier declaration of that namespace exported.A statement's import of types alone is kept for its module's effects, as an import at the template's root already was (
verbatimModuleSyntax). A localexportof a type a statement declares is removed, a statement left empty by stripping is removed rather than printed asstatic {}, and comments on removed type declarations are dropped.import … =andexport =are compile errors (import type … =is stripped), as is an enum or namespace a taglib migrator adds to a template whose source declares none. -
#4782
f019ff6Thanks @DylanPiercey! -modules: "cjs"output is converted by the compiler itself instead of Babel's CommonJS module transform, which is no longer bundled. As Babel's loose mode did, each export is a plain property assigned where it is declared (functions before anything is required, re-exports when their module is required) and again after each write to its binding. Imports read through their module, with interop for CommonJS modules without__esModule. A CommonJS compile skips Babel's extra traversals and, without project Babel plugins, the scope crawl after translating; project Babel plugins' visitors still run on the ES module first, and theirposthooks after the conversion, as with Babel's transform. A binding namedexportsorrequireanywhere, ormodule,__filenameor__dirnameat the top level, a write to an import, an export named__esModule, andstripTypes: false, are compile errors with CommonJS output.
Patch Changes
-
#4789
bc5b704Thanks @DylanPiercey! - The compile cache keeps a small record of each template instead of the whole Babel file it was analyzed as, and Babel's path and scope caches are cleared whenever no compile is running. A long-running process such as a dev server kept both for every compile, which used more memory and made each full garbage collection slower.loadFileForTagandloadFileForImportfrom@marko/compiler/babel-utilsnow return that record, which has nopath,scopeorhub: only the template'sfilename,code,astandmetadata, and whether it is stillanalyzing. Upgrademarkoand@marko/runtime-tagstogether with@marko/compiler, as earlier versions of them read the Babel file.A template one compile loads through another, such as by following a re-export, now always reads the file system of that compile, not that of an earlier compile sharing its cache. A template whose translate throws is analyzed again on its next compile, so that compile reads nothing the failed one left on the cached analysis.
-
#4780
19d3136Thanks @DylanPiercey! - The builders, validators and definitionstypesexports are plain properties rather than getters, two deep for builders such asidentifier, so reading one calls nothing and the compiler loads faster.