Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const DIRTY_TAG = Symbol('DIRTY_TAG');
export const IS_DISPATCHING_ATTRS = Symbol('IS_DISPATCHING_ATTRS');
export const BOUNDS = Symbol('BOUNDS');

const EMBER_VIEW_REF = createPrimitiveRef('ember-view');
const EMBER_VIEW_REF = /* @__PURE__ */ createPrimitiveRef('ember-view');

function aliasIdToElementId(args: VMArguments, props: any) {
if (args.named.has('id')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/glimmer/lib/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ interface Component<S = unknown>
extends CoreView, TargetActionSupport, ActionSupport, ComponentMethods {}

class Component<S = unknown>
extends CoreView.extend(
extends /* @__PURE__ */ CoreView.extend(
TargetActionSupport,
ActionSupport,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { InternalOwner } from '@ember/-internals/owner';
import type { Helper, HelperDefinitionState } from '@glimmer/interfaces';
import { setInternalHelperManager } from '@glimmer/manager/lib/internal/api';

/* @__NO_SIDE_EFFECTS__ */
export function internalHelper(helper: Helper<InternalOwner>): HelperDefinitionState {
return setInternalHelperManager(helper, {});
}
2 changes: 1 addition & 1 deletion packages/@ember/-internals/runtime/lib/mixins/-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ interface ProxyMixin<T = unknown> {
setUnknownProperty<V>(key: string, value: V): V;
}

const ProxyMixin = Mixin.create({
const ProxyMixin = /* @__PURE__ */ Mixin.create({
/**
The object whose properties will be forwarded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ActionHandler {
actions?: Record<string, (...args: any[]) => unknown>;
send(actionName: string, ...args: unknown[]): void;
}
const ActionHandler = Mixin.create({
const ActionHandler = /* @__PURE__ */ Mixin.create({
mergedProperties: ['actions'],

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Mixin from '@ember/object/mixin';
interface Comparable {
compare: ((a: unknown, b: unknown) => -1 | 0 | 1) | null;
}
const Comparable = Mixin.create({
const Comparable = /* @__PURE__ */ Mixin.create({
/**
__Required.__ You must implement this method to apply this mixin.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ContainerProxyMixin extends ContainerProxy {
/** @internal */
__container__: Container;
}
const ContainerProxyMixin = Mixin.create({
const ContainerProxyMixin = /* @__PURE__ */ Mixin.create({
/**
The container stores state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface RegistryProxyMixin extends RegistryProxy {
/** @internal */
__registry__: Registry;
}
const RegistryProxyMixin = Mixin.create({
const RegistryProxyMixin = /* @__PURE__ */ Mixin.create({
__registry__: null,

resolveRegistration(fullName: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface TargetActionSupport {
/** @internal */
_target?: unknown;
}
const TargetActionSupport = Mixin.create({
const TargetActionSupport = /* @__PURE__ */ Mixin.create({
target: null,
action: null,
actionContext: null,
Expand Down
6 changes: 3 additions & 3 deletions packages/@ember/-internals/string/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import Cache from '@ember/-internals/utils/lib/cache';

const STRING_DASHERIZE_REGEXP = /[ _]/g;

const STRING_DASHERIZE_CACHE = new Cache<string, string>(1000, (key) =>
const STRING_DASHERIZE_CACHE = /* @__PURE__ */ new Cache<string, string>(1000, (key) =>
decamelize(key).replace(STRING_DASHERIZE_REGEXP, '-')
);

const STRING_CLASSIFY_REGEXP_1 = /^(-|_)+(.)?/;
const STRING_CLASSIFY_REGEXP_2 = /(.)(-|_|\.|\s)+(.)?/g;
const STRING_CLASSIFY_REGEXP_3 = /(^|\/|\.)([a-z])/g;

const CLASSIFY_CACHE = new Cache<string, string>(1000, (str) => {
const CLASSIFY_CACHE = /* @__PURE__ */ new Cache<string, string>(1000, (str) => {
let replace1 = (_match: string, _separator: string, chr: string) =>
chr ? `_${chr.toUpperCase()}` : '';
let replace2 = (_match: string, initialChar: string, _separator: string, chr: string) =>
Expand All @@ -35,7 +35,7 @@ const CLASSIFY_CACHE = new Cache<string, string>(1000, (str) => {

const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;

const DECAMELIZE_CACHE = new Cache<string, string>(1000, (str) =>
const DECAMELIZE_CACHE = /* @__PURE__ */ new Cache<string, string>(1000, (str) =>
str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase()
);

Expand Down
1 change: 1 addition & 0 deletions packages/@ember/-internals/utils/lib/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// appears worthwhile in some usecases. Please note, these deletes do increase
// the cost of creation dramatically over a plain Object.create. And as this
// only makes sense for long-lived dictionaries that aren't instantiated often.
/* @__NO_SIDE_EFFECTS__ */
export default function makeDictionary<T>(parent: { [key: string]: T } | null): {
[key: string]: T;
} {
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/utils/lib/guid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const NON_OBJECT_GUIDS = new Map();
@type String
@final
*/
export const GUID_KEY = intern(`__ember${Date.now()}`);
export const GUID_KEY = /* @__PURE__ */ intern(`__ember${Date.now()}`);

/**
Generates a new guid, optionally saving the guid to the object that you
Expand Down
1 change: 1 addition & 0 deletions packages/@ember/-internals/utils/lib/intern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@private
@return {String} interned version of the provided string
*/
/* @__NO_SIDE_EFFECTS__ */
export default function intern<S extends string>(str: S): S {
let obj: Record<S, number> = Object.create(null);
obj[str] = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { assert } from '@ember/debug';
interface ActionSupport {
send(actionName: string, ...args: unknown[]): void;
}
const ActionSupport = Mixin.create({
const ActionSupport = /* @__PURE__ */ Mixin.create({
send(actionName: string, ...args: unknown[]) {
assert(
`Attempted to call .send() with the action '${actionName}' on the destroyed object '${this}'.`,
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/-internals/views/lib/views/core_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import states from './states';
*/

interface CoreView extends Evented, ActionHandler, View {}
class CoreView extends FrameworkObject.extend(Evented, ActionHandler) {
class CoreView extends /* @__PURE__ */ FrameworkObject.extend(Evented, ActionHandler) {
isView = true;

declare _states: typeof states;
Expand Down
6 changes: 3 additions & 3 deletions packages/@ember/array/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ interface EmberArray<T> extends Enumerable {
*/
without(value: T): NativeArray<T>;
}
const EmberArray = Mixin.create(Enumerable, {
const EmberArray = /* @__PURE__ */ Mixin.create(Enumerable, {
init() {
this._super(...arguments);
setEmberArray(this);
Expand Down Expand Up @@ -1687,7 +1687,7 @@ interface MutableArray<T> extends EmberArray<T>, MutableEnumerable {
*/
addObjects(objects: T[]): this;
}
const MutableArray = Mixin.create(EmberArray, MutableEnumerable, {
const MutableArray = /* @__PURE__ */ Mixin.create(EmberArray, MutableEnumerable, {
clear() {
let len = this.length;
if (len === 0) {
Expand Down Expand Up @@ -2019,7 +2019,7 @@ interface MutableArrayWithoutNative<T> extends Omit<
*/
interface NativeArray<T> extends Array<T>, Observable, MutableArrayWithoutNative<T> {}

let NativeArray = Mixin.create(MutableArray, Observable, {
let NativeArray = /* @__PURE__ */ Mixin.create(MutableArray, Observable, {
objectAt(idx: number) {
return this[idx];
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@ember/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ interface ControllerMixin<T> extends ActionHandler {
*/
replaceRoute(...args: RouteArgs): Transition;
}
const ControllerMixin = Mixin.create(ActionHandler, {
const ControllerMixin = /* @__PURE__ */ Mixin.create(ActionHandler, {
/* ducktype as a controller */
isController: true,

Expand Down Expand Up @@ -315,7 +315,7 @@ const ControllerMixin = Mixin.create(ActionHandler, {
@public
*/
interface Controller<_T = unknown> extends FrameworkObject, ControllerMixin<_T> {}
class Controller<_T = unknown> extends FrameworkObject.extend(ControllerMixin) {}
class Controller<_T = unknown> extends /* @__PURE__ */ FrameworkObject.extend(ControllerMixin) {}

/**
Creates a property that lazily looks up another controller in the container.
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface Initializer<T> {
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Engine extends RegistryProxyMixin {}
class Engine extends Namespace.extend(RegistryProxyMixin) {
class Engine extends /* @__PURE__ */ Namespace.extend(RegistryProxyMixin) {
static initializers: Record<string, Initializer<Engine>> = Object.create(null);
static instanceInitializers: Record<string, Initializer<EngineInstance>> = Object.create(null);

Expand Down
4 changes: 3 additions & 1 deletion packages/@ember/engine/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export interface EngineInstanceOptions {
// type checking, we have broken part of our public API contract. Medium-term,
// the goal here is to `EngineInstance` simple be `Owner`.
interface EngineInstance extends RegistryProxyMixin, ContainerProxyMixin, InternalOwner, Owner {}
class EngineInstance extends EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin) {
class EngineInstance
extends /* @__PURE__ */ EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin)
{
/**
@private
@method setupRegistry
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/enumerable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ import Mixin from '@ember/object/mixin';
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Enumerable {}
const Enumerable = Mixin.create();
const Enumerable = /* @__PURE__ */ Mixin.create();

export default Enumerable;
2 changes: 1 addition & 1 deletion packages/@ember/enumerable/mutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ import Mixin from '@ember/object/mixin';
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface MutableEnumerable extends Enumerable {}
const MutableEnumerable = Mixin.create(Enumerable);
const MutableEnumerable = /* @__PURE__ */ Mixin.create(Enumerable);

export default MutableEnumerable;
2 changes: 1 addition & 1 deletion packages/@ember/object/evented.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ interface Evented {
*/
has(name: string): boolean;
}
const Evented = Mixin.create({
const Evented = /* @__PURE__ */ Mixin.create({
on(name: string, target: object, method?: string | Function) {
addListener(this, name, target, method);
return this;
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/object/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export { default as computed } from '@ember/-internals/metal/lib/computed';
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface EmberObject extends Observable {}
class EmberObject extends CoreObject.extend(Observable) {
class EmberObject extends /* @__PURE__ */ CoreObject.extend(Observable) {
get _debugContainerKey() {
let factory = getFactoryFor(this);
return factory !== undefined && factory.fullName;
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/object/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ interface Observable {
*/
cacheFor<K extends keyof this>(key: K): unknown;
}
const Observable = Mixin.create({
const Observable = /* @__PURE__ */ Mixin.create({
get(keyName: string) {
return get(this, keyName);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/object/promise-proxy-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ interface PromiseProxyMixin<T> {
*/
finally: this['promise']['finally'];
}
const PromiseProxyMixin = Mixin.create({
const PromiseProxyMixin = /* @__PURE__ */ Mixin.create({
reason: null,

isPending: computed('isSettled', function () {
Expand Down
5 changes: 4 additions & 1 deletion packages/@ember/routing/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ interface Route<Model = unknown> extends IRoute<Model>, ActionHandler, Evented {
error?(error: Error, transition: Transition): boolean | void;
}

class Route<Model = unknown> extends EmberObject.extend(ActionHandler, Evented) implements IRoute {
class Route<Model = unknown>
extends /* @__PURE__ */ EmberObject.extend(ActionHandler, Evented)
implements IRoute
{
static isRouteFactory = true;

// These properties will end up appearing in the public interface because we
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/routing/router-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface RouterService extends Evented {
callback: (transition: Transition) => void
): this;
}
class RouterService extends Service.extend(Evented) {
class RouterService extends /* @__PURE__ */ Service.extend(Evented) {
[ROUTER]?: EmberRouter;

get _router(): EmberRouter {
Expand Down
2 changes: 1 addition & 1 deletion packages/@ember/routing/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const { slice } = Array.prototype;
@uses Evented
@public
*/
class EmberRouter extends EmberObject.extend(Evented) implements Evented {
class EmberRouter extends /* @__PURE__ */ EmberObject.extend(Evented) implements Evented {
/**
Represents the URL of the root of the application, often '/'. This prefix is
assumed on all routes defined on this router.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Cache from '@ember/-internals/utils/lib/cache';
const SIMPLE_DASHERIZE_REGEXP = /[A-Z]|::/g;
const ALPHA = /[A-Za-z0-9]/;

export default new Cache<string, string>(1000, (key) =>
export default /* @__PURE__ */ new Cache<string, string>(1000, (key) =>
key.replace(SIMPLE_DASHERIZE_REGEXP, (char, index) => {
if (char === '::') {
return '/';
Expand Down
1 change: 1 addition & 0 deletions packages/@glimmer/opcode-compiler/lib/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface TemplateWithIdAndReferrer extends TemplateOk {
* that handles lazy parsing the template and to create per env singletons
* of the template.
*/
/* @__NO_SIDE_EFFECTS__ */
export default function templateFactory({
id: templateId,
moduleName,
Expand Down
5 changes: 3 additions & 2 deletions packages/@glimmer/program/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ import { InternalComponentCapabilities } from '@glimmer/vm/lib/flags';
import { DEFAULT_TEMPLATE } from './util/default-template';

const WELL_KNOWN_EMPTY_ARRAY: unknown = Object.freeze([]);
const STARTER_CONSTANTS = constants(WELL_KNOWN_EMPTY_ARRAY);
const WELL_KNOWN_EMPTY_ARRAY_POSITION: number = STARTER_CONSTANTS.indexOf(WELL_KNOWN_EMPTY_ARRAY);
const STARTER_CONSTANTS = /* @__PURE__ */ constants(WELL_KNOWN_EMPTY_ARRAY);
const WELL_KNOWN_EMPTY_ARRAY_POSITION: number =
/* @__PURE__ */ STARTER_CONSTANTS.indexOf(WELL_KNOWN_EMPTY_ARRAY);

export class ConstantsImpl implements ProgramConstants {
protected reifiedArrs: { [key: number]: unknown[] } = {
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/program/lib/util/default-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DEFAULT_TEMPLATE: SerializedTemplateWithLazyBlock = {
// random uuid
id: '1b32f5c2-7623-43d6-a0ad-9672898920a1',
moduleName: '__default__.hbs',
block: JSON.stringify(DEFAULT_TEMPLATE_BLOCK),
block: /* @__PURE__ */ JSON.stringify(DEFAULT_TEMPLATE_BLOCK),
scope: null,
isStrictMode: true,
};
6 changes: 6 additions & 0 deletions packages/@glimmer/reference/lib/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class ReferenceImpl<T = unknown> implements Reference<T> {
}
}

/* @__NO_SIDE_EFFECTS__ */
export function createPrimitiveRef<T extends string | symbol | number | boolean | null | undefined>(
value: T
): Reference<T> {
Expand All @@ -72,6 +73,7 @@ export const NULL_REFERENCE = createPrimitiveRef(null);
export const TRUE_REFERENCE = createPrimitiveRef(true as const);
export const FALSE_REFERENCE = createPrimitiveRef(false as const);

/* @__NO_SIDE_EFFECTS__ */
export function createConstRef<T>(value: T, debugLabel: false | string): Reference<T> {
const ref = new ReferenceImpl<T>(CONSTANT);

Expand All @@ -85,6 +87,7 @@ export function createConstRef<T>(value: T, debugLabel: false | string): Referen
return ref;
}

/* @__NO_SIDE_EFFECTS__ */
export function createUnboundRef<T>(value: T, debugLabel: false | string): Reference<T> {
const ref = new ReferenceImpl<T>(UNBOUND);

Expand All @@ -98,6 +101,7 @@ export function createUnboundRef<T>(value: T, debugLabel: false | string): Refer
return ref;
}

/* @__NO_SIDE_EFFECTS__ */
export function createComputeRef<T = unknown>(
compute: () => T,
update: Nullable<(value: T) => void> = null,
Expand All @@ -115,6 +119,7 @@ export function createComputeRef<T = unknown>(
return ref;
}

/* @__NO_SIDE_EFFECTS__ */
export function createReadOnlyRef(ref: Reference): Reference {
if (!isUpdatableRef(ref)) return ref;

Expand All @@ -125,6 +130,7 @@ export function isInvokableRef(ref: Reference) {
return ref[REFERENCE] === INVOKABLE;
}

/* @__NO_SIDE_EFFECTS__ */
export function createInvokableRef(inner: Reference): Reference {
const ref = createComputeRef(
() => valueForRef(inner),
Expand Down
1 change: 1 addition & 0 deletions packages/@glimmer/runtime/lib/helpers/internal-helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Helper, HelperDefinitionState } from '@glimmer/interfaces';
import { setInternalHelperManager } from '@glimmer/manager/lib/internal/api';

/* @__NO_SIDE_EFFECTS__ */
export function internalHelper(helper: Helper): HelperDefinitionState {
return setInternalHelperManager(helper, {});
}
1 change: 1 addition & 0 deletions packages/@glimmer/util/lib/intern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@private
@return {String} interned version of the provided string
*/
/* @__NO_SIDE_EFFECTS__ */
export default function intern(str: string): string {
let obj: Record<string, number> = {};
obj[str] = 1;
Expand Down
Loading
Loading