mikuru 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +10 -4
- package/dist/compiler/compile.js +9 -2
- package/dist/compiler/compile.js.map +1 -1
- package/dist/compiler/compileHydration.js +9 -2
- package/dist/compiler/compileHydration.js.map +1 -1
- package/dist/compiler/compileSsr.js +4 -1
- package/dist/compiler/compileSsr.js.map +1 -1
- package/dist/compiler/generate.d.ts +1 -0
- package/dist/compiler/generate.js +17 -2
- package/dist/compiler/generate.js.map +1 -1
- package/dist/compiler/generateHydration.js +1 -1
- package/dist/compiler/generateHydration.js.map +1 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/parseSfc.js +20 -2
- package/dist/compiler/parseSfc.js.map +1 -1
- package/dist/compiler/sourceMap.js +72 -16
- package/dist/compiler/sourceMap.js.map +1 -1
- package/dist/compiler/templateTypeCheck.d.ts +19 -0
- package/dist/compiler/templateTypeCheck.js +270 -0
- package/dist/compiler/templateTypeCheck.js.map +1 -0
- package/dist/compiler/types.d.ts +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/devtools.d.ts +19 -5
- package/dist/runtime/devtools.js +26 -3
- package/dist/runtime/devtools.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/vite.d.ts +1 -0
- package/dist/vite.js +65 -3
- package/dist/vite.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.27 - 2026-05-15
|
|
4
|
+
|
|
5
|
+
- Added dogfood Mikuru video and audio player components with custom controls, template refs, lifecycle cleanup, keyboard-accessible div-based seeking, volume, mute, playback rate, stop, and fullscreen controls.
|
|
6
|
+
- Updated the dogfood media player UI with video-overlay controls, Font Awesome-shaped CSS mask icons, auto-hiding playback controls, and a custom seek track that renders cleanly at the final position.
|
|
7
|
+
- Fixed Vite-routed component CSS requests so style virtual module URLs are keyed by compiled style content, preventing stale `<style scoped>` CSS from being reused after SFC style changes.
|
|
8
|
+
- Added compiler coverage for content-keyed Vite CSS requests so repeated transforms of the same `.mikuru` file with changed styles resolve to distinct style module URLs.
|
|
9
|
+
|
|
3
10
|
## 1.0.26 - 2026-05-15
|
|
4
11
|
|
|
5
12
|
- Improved scoped CSS rewriting with native CSS nesting, `@starting-style`, additional raw descriptor at-rules, and stronger `:deep(...)` / `:global(...)` parsing around attributes and functional pseudo-class arguments.
|
package/README.md
CHANGED
|
@@ -149,8 +149,11 @@ declare const Greeting: MikuruComponent<GreetingProps>;
|
|
|
149
149
|
- SSR through `compileSsr()` and `mikuru/server`, covering escaped text, static and bound attributes, content directives, `m-pre`, `m-cloak`, `m-if` chains, `m-for`, async child components, props, named/default slots, scoped slot props, component tree context, Teleport collection, string and async iterable stream rendering, and router route rendering with context propagation
|
|
150
150
|
- Hydration through `compileHydration()` and `hydrateRoute()`, reusing existing SSR DOM while attaching events, syncing text/attributes, recovering structural mismatches with an opt-out remount fallback, hydrating component context/lifecycle hooks, `m-show`, DOM and component `m-model`, `m-pre`, `m-cloak`, initial `m-if` / `m-for` DOM, Teleport target and disabled inline content, delegating child and route components to `hydrate()` when available, and optionally starting router history listening after route hydration
|
|
151
151
|
- Style injection and `<style scoped>` selector rewriting for common selectors, native CSS nesting, `:global(...)`, `:deep(...)`, nested at-rules, and malformed CSS diagnostics
|
|
152
|
+
- Vite-routed component CSS for CSS Modules with `<style module>`, preprocessor languages such as `<style lang="scss">`, and project-level CSS transforms such as PostCSS when using `mikuru/vite`
|
|
153
|
+
- Content-keyed Vite style requests so `.mikuru` scoped CSS updates reload reliably during development instead of reusing stale virtual style modules
|
|
154
|
+
- Optional TypeScript template type checking with `typeCheckTemplate()`, `compile(..., { templateTypeCheck: true })`, and `mikuru({ templateTypeCheck: true })`, including script bindings, `defineProps()` constructor inference, ref unwrapping, and `m-for` item/index scopes
|
|
152
155
|
- Compile errors with filenames, line/column information, code frames, and typo suggestions for built-in attributes, directives, and modifiers
|
|
153
|
-
-
|
|
156
|
+
- Stable devtools diagnostics with optional generated `sourceURL`, `v-*` compatibility warnings, versioned metadata/events, component tree snapshots, compiler/style diagnostic locations and frames, and hydration warnings that include phase, component, and filename context
|
|
154
157
|
|
|
155
158
|
## Package Exports
|
|
156
159
|
|
|
@@ -228,9 +231,7 @@ const open = ref(false);
|
|
|
228
231
|
|
|
229
232
|
## Not Included in v1
|
|
230
233
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Scoped CSS is supported for common selector rewriting, native CSS nesting, `:global(...)`, `:deep(...)`, nested at-rules such as `@media`, `@scope`, and `@starting-style`, and malformed block diagnostics. What is not included in v1 is a full CSS compiler: CSS Modules, preprocessors, and project-level CSS transforms stay outside the package.
|
|
234
|
+
- Full Vue compatibility.
|
|
234
235
|
|
|
235
236
|
## Repository Development
|
|
236
237
|
|
|
@@ -267,6 +268,11 @@ npm run dev:mikuru-sample
|
|
|
267
268
|
npm run dev:mikuru-vue-like
|
|
268
269
|
```
|
|
269
270
|
|
|
271
|
+
The dogfood example also includes original Mikuru media player components:
|
|
272
|
+
|
|
273
|
+
- `MikuruVideoPlayer.mikuru`: overlay video controls, div-based seeking, volume/mute, playback rate, stop, and fullscreen controls.
|
|
274
|
+
- `MikuruAudioPlayer.mikuru`: audio playback with seeking, skip controls, volume, and mute.
|
|
275
|
+
|
|
270
276
|
## Documentation
|
|
271
277
|
|
|
272
278
|
- `CHANGELOG.md` lists published package changes.
|
package/dist/compiler/compile.js
CHANGED
|
@@ -5,6 +5,7 @@ import { generate } from "./generate.js";
|
|
|
5
5
|
import { parseSfc } from "./parseSfc.js";
|
|
6
6
|
import { parseTemplate } from "./parseTemplate.js";
|
|
7
7
|
import { createSourceMap } from "./sourceMap.js";
|
|
8
|
+
import { assertTemplateTypeCheck } from "./templateTypeCheck.js";
|
|
8
9
|
import { emitDebugDiagnostic } from "../runtime/devtools.js";
|
|
9
10
|
export function compile(source, options = {}) {
|
|
10
11
|
try {
|
|
@@ -15,6 +16,7 @@ export function compile(source, options = {}) {
|
|
|
15
16
|
offset: descriptor.templateOffset
|
|
16
17
|
});
|
|
17
18
|
emitCompatDirectiveDiagnostics(ast, { debug: options.debug === true, filename: options.filename, phase: "compile" });
|
|
19
|
+
const templateTypeCheck = options.templateTypeCheck === true ? assertTemplateTypeCheck(descriptor, ast) : undefined;
|
|
18
20
|
if (options.debug === true && descriptor.style?.trim()) {
|
|
19
21
|
const styleResult = compileDescriptorStyle(descriptor, descriptor.styleScoped ? `data-mikuru-scope-preview` : undefined);
|
|
20
22
|
for (const diagnostic of styleResult.diagnostics) {
|
|
@@ -29,14 +31,19 @@ export function compile(source, options = {}) {
|
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
const bindings = analyzeTemplate(ast, { source, filename: options.filename });
|
|
32
|
-
const code = generate(descriptor, ast, {
|
|
34
|
+
const code = generate(descriptor, ast, {
|
|
35
|
+
debug: options.debug === true,
|
|
36
|
+
batchedUpdates: options.batchedUpdates === true,
|
|
37
|
+
externalStyles: options.externalStyles === true
|
|
38
|
+
});
|
|
33
39
|
const map = createSourceMap(code, descriptor, ast);
|
|
34
40
|
return {
|
|
35
41
|
code,
|
|
36
42
|
map,
|
|
37
43
|
descriptor,
|
|
38
44
|
ast,
|
|
39
|
-
bindings
|
|
45
|
+
bindings,
|
|
46
|
+
templateTypeCheck
|
|
40
47
|
};
|
|
41
48
|
}
|
|
42
49
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/compiler/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MA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M,GAAG,GAAG,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QAEnD,OAAO;YACL,IAAI;YACJ,GAAG;YACH,UAAU;YACV,GAAG;YACH,QAAQ;YACR,iBAAiB;SAClB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC/F,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK;SACN,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { generateHydration } from "./generateHydration.js";
|
|
|
5
5
|
import { parseSfc } from "./parseSfc.js";
|
|
6
6
|
import { parseTemplate } from "./parseTemplate.js";
|
|
7
7
|
import { createSourceMap } from "./sourceMap.js";
|
|
8
|
+
import { assertTemplateTypeCheck } from "./templateTypeCheck.js";
|
|
8
9
|
import { emitDebugDiagnostic } from "../runtime/devtools.js";
|
|
9
10
|
export function compileHydration(source, options = {}) {
|
|
10
11
|
try {
|
|
@@ -15,8 +16,13 @@ export function compileHydration(source, options = {}) {
|
|
|
15
16
|
offset: descriptor.templateOffset
|
|
16
17
|
});
|
|
17
18
|
emitCompatDirectiveDiagnostics(ast, { debug: options.debug === true, filename: options.filename, phase: "compile-hydration" });
|
|
19
|
+
const templateTypeCheck = options.templateTypeCheck === true ? assertTemplateTypeCheck(descriptor, ast) : undefined;
|
|
18
20
|
const bindings = analyzeTemplate(ast, { source, filename: options.filename });
|
|
19
|
-
const mountCode = generate(descriptor, ast, {
|
|
21
|
+
const mountCode = generate(descriptor, ast, {
|
|
22
|
+
debug: options.debug === true,
|
|
23
|
+
batchedUpdates: options.batchedUpdates === true,
|
|
24
|
+
externalStyles: options.externalStyles === true
|
|
25
|
+
});
|
|
20
26
|
const hydrationCode = generateHydration(descriptor, ast, { includeImports: false });
|
|
21
27
|
const code = mountCode.replace("export default __mikuru_component;", `${hydrationCode}\nconst __mikuru_hydrationComponent = { ...__mikuru_component, hydrate };\nexport default __mikuru_hydrationComponent;`);
|
|
22
28
|
const map = createSourceMap(code, descriptor, ast);
|
|
@@ -25,7 +31,8 @@ export function compileHydration(source, options = {}) {
|
|
|
25
31
|
map,
|
|
26
32
|
descriptor,
|
|
27
33
|
ast,
|
|
28
|
-
bindings
|
|
34
|
+
bindings,
|
|
35
|
+
templateTypeCheck
|
|
29
36
|
};
|
|
30
37
|
}
|
|
31
38
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileHydration.js","sourceRoot":"","sources":["../../src/compiler/compileHydration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"compileHydration.js","sourceRoot":"","sources":["../../src/compiler/compileHydration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eA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AC,UAAU,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,oCAAoC,EAAE,GAAG,aAAa,wHAAwH,CAAC,CAAC;QAC/M,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QAEnD,OAAO;YACL,IAAI;YACJ,GAAG;YACH,UAAU;YACV,GAAG;YACH,QAAQ;YACR,iBAAiB;SAClB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC/F,KAAK,EAAE,mBAAmB;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK;SACN,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { emitCompatDirectiveDiagnostics } from "./compatDiagnostics.js";
|
|
|
3
3
|
import { generateSsr } from "./generateSsr.js";
|
|
4
4
|
import { parseSfc } from "./parseSfc.js";
|
|
5
5
|
import { parseTemplate } from "./parseTemplate.js";
|
|
6
|
+
import { assertTemplateTypeCheck } from "./templateTypeCheck.js";
|
|
6
7
|
import { emitDebugDiagnostic } from "../runtime/devtools.js";
|
|
7
8
|
export function compileSsr(source, options = {}) {
|
|
8
9
|
try {
|
|
@@ -13,13 +14,15 @@ export function compileSsr(source, options = {}) {
|
|
|
13
14
|
offset: descriptor.templateOffset
|
|
14
15
|
});
|
|
15
16
|
emitCompatDirectiveDiagnostics(ast, { debug: options.debug === true, filename: options.filename, phase: "compile-ssr" });
|
|
17
|
+
const templateTypeCheck = options.templateTypeCheck === true ? assertTemplateTypeCheck(descriptor, ast) : undefined;
|
|
16
18
|
const bindings = analyzeTemplate(ast, { source, filename: options.filename });
|
|
17
19
|
const code = generateSsr(descriptor, ast);
|
|
18
20
|
return {
|
|
19
21
|
code,
|
|
20
22
|
descriptor,
|
|
21
23
|
ast,
|
|
22
|
-
bindings
|
|
24
|
+
bindings,
|
|
25
|
+
templateTypeCheck
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileSsr.js","sourceRoot":"","sources":["../../src/compiler/compileSsr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"compileSsr.js","sourceRoot":"","sources":["../../src/compiler/compileSsr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,UAA0B,EAAE;IACrE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE;YAC7C,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM;YACN,MAAM,EAAE,UAAU,CAAC,cAAc;SAClC,CAAC,CAAC;QACH,8BAA8B,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;QACzH,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpH,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAE1C,OAAO;YACL,IAAI;YACJ,UAAU;YACV,GAAG;YACH,QAAQ;YACR,iBAAiB;SAClB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC/F,KAAK,EAAE,aAAa;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK;SACN,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -14,6 +14,7 @@ export type GenerateContext = {
|
|
|
14
14
|
type GenerateOptions = {
|
|
15
15
|
debug?: boolean;
|
|
16
16
|
batchedUpdates?: boolean;
|
|
17
|
+
externalStyles?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export declare function generate(descriptor: SfcDescriptor, root: ElementNode, options?: GenerateOptions): string;
|
|
19
20
|
export declare function generateNode(context: GenerateContext, node: TemplateNode, parentVar: string, cleanupVar: string, indent: number, beforeVar?: string): string;
|
|
@@ -146,8 +146,15 @@ export function generate(descriptor, root, options = {}) {
|
|
|
146
146
|
emit(context, 1, "};");
|
|
147
147
|
emit(context, 1, "");
|
|
148
148
|
if (descriptor.style?.trim()) {
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
if (options.externalStyles === true) {
|
|
150
|
+
emitExternalStyleDebugEvent(context, descriptor, 1);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
emitStyleInjection(context, descriptor, 1);
|
|
154
|
+
}
|
|
155
|
+
if (options.externalStyles !== true || context.debug) {
|
|
156
|
+
emit(context, 1, "");
|
|
157
|
+
}
|
|
151
158
|
}
|
|
152
159
|
if (script.body.trim()) {
|
|
153
160
|
if (script.usesPropsAlias) {
|
|
@@ -216,6 +223,14 @@ function emitStyleInjection(context, descriptor, indent) {
|
|
|
216
223
|
}
|
|
217
224
|
emit(context, indent, "}");
|
|
218
225
|
}
|
|
226
|
+
function emitExternalStyleDebugEvent(context, descriptor, indent) {
|
|
227
|
+
if (!context.debug) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const styleId = `mikuru-${hash(`${descriptor.filename ?? ""}\n${descriptor.style ?? ""}`)}`;
|
|
231
|
+
const styleResult = compileDescriptorStyle(descriptor, context.scopeAttr);
|
|
232
|
+
emit(context, indent, `emitDebugEvent("style:inject", { component: __mikuru_componentInfo, componentId: __mikuru_debug.id, style: { id: ${quote(styleId)}, scoped: ${styleResult.scoped ? "true" : "false"}, scopeAttr: ${quote(styleResult.scopeAttr)}, length: ${styleResult.code.length}, external: true } });`);
|
|
233
|
+
}
|
|
219
234
|
function emitDevtoolsRegistration(context, indent) {
|
|
220
235
|
if (!context.debug) {
|
|
221
236
|
return;
|