Skip to content

Commit 6938995

Browse files
authored
[all] Change from greek prefixes to ASCII (lit#1959)
* Revert private prefixes from greek to ascii * Fix imported symbols * Additional renames. * Add `_` to all prefixes * Update changesets metadata
1 parent a9b1591 commit 6938995

11 files changed

+37
-30
lines changed

.changeset/fifty-trainers-check.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'lit-html': major
3+
---
4+
5+
Changed all prefixes used for minifying object and class properties from greek
6+
characters to ASCII, to avoid requiring an explicit script charset on some
7+
browser/webview environments.

packages/labs/ssr/src/lib/lit-element-renderer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
import {ElementRenderer} from './element-renderer.js';
88
import {LitElement, CSSResult, ReactiveElement} from 'lit';
9-
import {} from 'lit-element/private-ssr-support.js';
9+
import {_$LE} from 'lit-element/private-ssr-support.js';
1010
import {render, RenderInfo} from './render-lit-html.js';
1111

1212
export type Constructor<T> = {new (): T};
1313

14-
const {attributeToProperty, changedProperties} = ;
14+
const {attributeToProperty, changedProperties} = _$LE;
1515

1616
/**
1717
* ElementRenderer implementation for LitElements

packages/labs/ssr/src/lib/render-lit-html.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
import {nothing, noChange} from 'lit';
1717
import {PartType} from 'lit/directive.js';
1818
import {isTemplateResult} from 'lit/directive-helpers.js';
19-
import {} from 'lit-html/private-ssr-support.js';
19+
import {_$LH} from 'lit-html/private-ssr-support.js';
2020

2121
const {
2222
getTemplateHtml,
@@ -30,7 +30,7 @@ const {
3030
PropertyPart,
3131
BooleanAttributePart,
3232
EventPart,
33-
} = ;
33+
} = _$LH;
3434

3535
import {digestForTemplateResult} from 'lit/experimental-hydrate.js';
3636

packages/lit-element/src/lit-element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ if (DEV_MODE) {
207207
*
208208
* We currently do not make a mangled rollup build of the lit-ssr code. In order
209209
* to keep a number of (otherwise private) top-level exports mangled in the
210-
* client side code, we export a object containing those members (or
210+
* client side code, we export a _$LE object containing those members (or
211211
* helper methods for accessing private fields of those members), and then
212212
* re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
213213
* client-side code is being used in `dev` mode or `prod` mode.
@@ -217,7 +217,7 @@ if (DEV_MODE) {
217217
*
218218
* @private
219219
*/
220-
export const = {
220+
export const _$LE = {
221221
_$attributeToProperty: (
222222
el: LitElement,
223223
name: string,

packages/lit-element/src/private-ssr-support.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
66

7-
import { as p} from './lit-element.js';
7+
import {_$LE as p} from './lit-element.js';
88

99
/**
1010
* END USERS SHOULD NOT RELY ON THIS OBJECT.
1111
*
1212
* We currently do not make a mangled rollup build of the lit-ssr code. In order
1313
* to keep a number of (otherwise private) top-level exports mangled in the
14-
* client side code, we export a object containing those members (or
14+
* client side code, we export a _$LE object containing those members (or
1515
* helper methods for accessing private fields of those members), and then
1616
* re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
1717
* client-side code is being used in `dev` mode or `prod` mode.
1818
*
1919
* @private
2020
*/
21-
export const = {
21+
export const _$LE = {
2222
attributeToProperty: p._$attributeToProperty,
2323
changedProperties: p._$changedProperties,
2424
};

packages/lit-html/src/directive-helpers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
66

7-
import {, Part, DirectiveParent, TemplateResult} from './lit-html.js';
7+
import {_$LH, Part, DirectiveParent, TemplateResult} from './lit-html.js';
88
import {
99
DirectiveResult,
1010
DirectiveClass,
@@ -13,7 +13,7 @@ import {
1313
} from './directive.js';
1414
type Primitive = null | undefined | boolean | number | string | symbol | bigint;
1515

16-
const {_ChildPart: ChildPart} = ;
16+
const {_ChildPart: ChildPart} = _$LH;
1717

1818
type ChildPart = InstanceType<typeof ChildPart>;
1919

packages/lit-html/src/experimental-hydrate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import type {TemplateResult} from './lit-html.js';
88

9-
import {noChange, RenderOptions, } from './lit-html.js';
9+
import {noChange, RenderOptions, _$LH} from './lit-html.js';
1010
import {AttributePartInfo, PartType} from './directive.js';
1111
import {
1212
isPrimitive,
@@ -20,7 +20,7 @@ const {
2020
_resolveDirective: resolveDirective,
2121
_ChildPart: ChildPart,
2222
_ElementPart: ElementPart,
23-
} = ;
23+
} = _$LH;
2424

2525
type ChildPart = InstanceType<typeof ChildPart>;
2626
type TemplateInstance = InstanceType<typeof TemplateInstance>;

packages/lit-html/src/lit-html.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ class ElementPart {
15191519
*
15201520
* We currently do not make a mangled rollup build of the lit-ssr code. In order
15211521
* to keep a number of (otherwise private) top-level exports mangled in the
1522-
* client side code, we export a object containing those members (or
1522+
* client side code, we export a _$LH object containing those members (or
15231523
* helper methods for accessing private fields of those members), and then
15241524
* re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
15251525
* client-side code is being used in `dev` mode or `prod` mode.
@@ -1529,7 +1529,7 @@ class ElementPart {
15291529
*
15301530
* @private
15311531
*/
1532-
export const = {
1532+
export const _$LH = {
15331533
// Used in lit-ssr
15341534
_boundAttributeSuffix: boundAttributeSuffix,
15351535
_marker: marker,

packages/lit-html/src/private-ssr-support.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
*/
66

77
import {Directive, PartInfo} from './directive.js';
8-
import { as p, AttributePart, noChange, Part} from './lit-html.js';
8+
import {_$LH as p, AttributePart, noChange, Part} from './lit-html.js';
99
export type {Template} from './lit-html.js';
1010

1111
/**
1212
* END USERS SHOULD NOT RELY ON THIS OBJECT.
1313
*
1414
* We currently do not make a mangled rollup build of the lit-ssr code. In order
1515
* to keep a number of (otherwise private) top-level exports mangled in the
16-
* client side code, we export a object containing those members (or
16+
* client side code, we export a _$LH object containing those members (or
1717
* helper methods for accessing private fields of those members), and then
1818
* re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the
1919
* client-side code is being used in `dev` mode or `prod` mode.
2020
* @private
2121
*/
22-
export const = {
22+
export const _$LH = {
2323
boundAttributeSuffix: p._boundAttributeSuffix,
2424
marker: p._marker,
2525
markerMatch: p._markerMatch,

packages/lit-html/src/test/lit-html_test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import {AsyncDirective} from '../async-directive.js';
3232
import {createRef, ref} from '../directives/ref.js';
3333

3434
// For compiled template tests
35-
import {} from '../private-ssr-support.js';
36-
const {AttributePart} = ;
35+
import {_$LH} from '../private-ssr-support.js';
36+
const {AttributePart} = _$LH;
3737

3838
type AttributePart = InstanceType<typeof AttributePart>;
3939

rollup-common.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ import virtual from '@rollup/plugin-virtual';
1717
// defined here rather than via an argument to litProdConfig() so we can
1818
// validate the list used by each package is unique (since copy/pasting the
1919
// individual package-based configs is common and error-prone)
20-
const STABLE_PROPERTY_PREFIX = 'Ξ';
20+
const STABLE_PROPERTY_PREFIX = '_$A';
2121
const PACKAGE_CLASS_PREFIXES = {
22-
lit: 'ϖ',
23-
'lit-html': 'Σ',
24-
'lit-element': 'Φ',
25-
'@lit/reactive-element': 'Π',
26-
'@lit-labs/motion': 'δ',
27-
'@lit-labs/react': 'Ω',
28-
'@lit-labs/scoped-registry-mixin': 'Ϋ',
29-
'@lit-labs/ssr-client': 'Λ',
30-
'@lit-labs/task': '',
22+
lit: '_$B',
23+
'lit-html': '_$C',
24+
'lit-element': '_$D',
25+
'@lit/reactive-element': '_$E',
26+
'@lit-labs/motion': '_$F',
27+
'@lit-labs/react': '_$G',
28+
'@lit-labs/scoped-registry-mixin': '_$H',
29+
'@lit-labs/ssr-client': '_$I',
30+
'@lit-labs/task': '_$J',
3131
};
3232

3333
// Validate prefix uniqueness

0 commit comments

Comments
 (0)