Skip to content

Commit c70367f

Browse files
committed
Successful build
1 parent 8485dce commit c70367f

44 files changed

Lines changed: 541 additions & 514 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addon/.eslintrc.cjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ module.exports = {
3737
rules: {
3838
// require relative imports use full extensions
3939
'import/extensions': ['error', 'always', { ignorePackages: true }],
40-
// Add any custom rules here
40+
// We break a lot of rules with types
41+
// (public types do not always exist for the things we need to import)
42+
'@typescript-eslint/ban-ts-comment': 'off',
43+
'@typescript-eslint/no-explicit-any': 'off',
44+
// We access the _routerMicrolib
45+
// and router:main
46+
'ember/no-private-routing-service': 'off',
4147
},
4248
},
4349
{

addon/.template-lintrc.cjs

Lines changed: 0 additions & 5 deletions
This file was deleted.

addon/rollup.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { babel } from '@rollup/plugin-babel';
22
import copy from 'rollup-plugin-copy';
33
import { Addon } from '@embroider/addon-dev/rollup';
4+
import { execaCommand } from "execa";
45

56
const addon = new Addon({
67
srcDir: 'src',
@@ -68,5 +69,12 @@ export default {
6869
{ src: '../LICENSE.md', dest: '.' },
6970
],
7071
}),
72+
{
73+
name: 'Build declarations',
74+
closeBundle: async () => {
75+
console.log("Building types");
76+
await execaCommand(`pnpm glint --declaration`, { stdio: "inherit" });
77+
}
78+
}
7179
],
7280
};

addon/src/-internal/build-registry.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { FullName } from '@ember/owner';
1313
import {
1414
ContainerProxyMixin,
1515
RegistryProxyMixin,
16-
} from './-owner-mixin-imports';
16+
} from './-owner-mixin-imports.ts';
1717

1818
/**
1919
* Adds methods that are normally only on registry to the container. This is largely to support the legacy APIs
@@ -23,7 +23,7 @@ import {
2323
* @param {Object} container the container to modify
2424
*/
2525
function exposeRegistryMethodsWithoutDeprecations(container: any) {
26-
let methods = [
26+
const methods = [
2727
'register',
2828
'unregister',
2929
'resolve',
@@ -38,7 +38,7 @@ function exposeRegistryMethodsWithoutDeprecations(container: any) {
3838
];
3939

4040
for (let i = 0, l = methods.length; i < l; i++) {
41-
let methodName = methods[i];
41+
const methodName = methods[i];
4242

4343
if (methodName && methodName in container) {
4444
const knownMethod = methodName;
@@ -87,7 +87,7 @@ const Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin, {
8787
* @returns {Object} owner, container, registry
8888
*/
8989
export default function buildRegistry(resolver: Resolver) {
90-
let namespace = new Application();
90+
const namespace = new Application();
9191
// @ts-ignore: this is actually the correcct type, but there was a typo in
9292
// Ember's docs for many years which meant that there was a matching problem
9393
// in the types for Ember's definition of `Engine`. Once we require at least
@@ -99,13 +99,13 @@ export default function buildRegistry(resolver: Resolver) {
9999
};
100100

101101
// @ts-ignore: this is private API.
102-
let fallbackRegistry = Application.buildRegistry(namespace);
102+
const fallbackRegistry = Application.buildRegistry(namespace);
103103
// TODO: only do this on Ember < 3.13
104104
// @ts-ignore: this is private API.
105105
fallbackRegistry.register('component-lookup:main', Ember.ComponentLookup);
106106

107107
// @ts-ignore: this is private API.
108-
let registry = new Ember.Registry({
108+
const registry = new Ember.Registry({
109109
fallback: fallbackRegistry,
110110
});
111111

@@ -123,7 +123,7 @@ export default function buildRegistry(resolver: Resolver) {
123123
// @ts-ignore: this is private API.
124124
registry.describe = fallbackRegistry.describe;
125125

126-
let owner = Owner.create({
126+
const owner = Owner.create({
127127
// @ts-ignore -- we do not have type safety for `Object.extend` so the type
128128
// of `Owner` here is just `EmberObject`, but we *do* constrain it to allow
129129
// only types from the actual class, so these fields are not accepted.
@@ -140,7 +140,7 @@ export default function buildRegistry(resolver: Resolver) {
140140
}) as unknown as Owner;
141141

142142
// @ts-ignore: this is private API.
143-
let container = registry.container({ owner: owner });
143+
const container = registry.container({ owner: owner });
144144
// @ts-ignore: this is private API.
145145
owner.__container__ = container;
146146

addon/src/-internal/debug-info.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// this type will be `any`.
44
import { _backburner } from '@ember/runloop';
55
import type { DebugInfo as BackburnerDebugInfo } from '@ember/runloop/-private/backburner';
6-
import { type DebugInfoHelper, debugInfoHelpers } from './debug-info-helpers';
6+
import {
7+
type DebugInfoHelper,
8+
debugInfoHelpers,
9+
} from './debug-info-helpers.ts';
710
import {
811
getPendingWaiterState,
912
type PendingWaiterState,
@@ -89,7 +92,7 @@ export class TestDebugInfo implements DebugInfo {
8992

9093
constructor(
9194
settledState: SettledState,
92-
debugInfo: MaybeDebugInfo = getDebugInfo()
95+
debugInfo: MaybeDebugInfo = getDebugInfo(),
9396
) {
9497
this._settledState = settledState;
9598
this._debugInfo = debugInfo;
@@ -107,7 +110,7 @@ export class TestDebugInfo implements DebugInfo {
107110
this._settledState.hasPendingTimers &&
108111
this._summaryInfo.pendingTimersCount > 0;
109112
this._summaryInfo.pendingTimersStackTraces = this._debugInfo.timers.map(
110-
(timer) => timer.stack
113+
(timer) => timer.stack,
111114
);
112115

113116
this._summaryInfo.pendingScheduledQueueItemCount =
@@ -135,7 +138,8 @@ export class TestDebugInfo implements DebugInfo {
135138
// also be compatible with the version where Ember *does* supply
136139
// the types correctly.
137140
(queueItems as Array<{ stack: string }> | undefined)?.forEach(
138-
(queueItem) => queueItem.stack && stacks.push(queueItem.stack)
141+
(queueItem) =>
142+
queueItem.stack && stacks.push(queueItem.stack),
139143
);
140144
});
141145
return stacks;
@@ -177,14 +181,14 @@ export class TestDebugInfo implements DebugInfo {
177181
_console.log(
178182
`${debugInfo.label ? debugInfo.label : 'stack'}: ${
179183
debugInfo.stack
180-
}`
184+
}`,
181185
);
182186
});
183187
_console.groupEnd();
184188
} else {
185189
_console.log(waiterName);
186190
}
187-
}
191+
},
188192
);
189193
}
190194

@@ -201,7 +205,7 @@ export class TestDebugInfo implements DebugInfo {
201205
summary.pendingScheduledQueueItemStackTraces.forEach(
202206
(scheduleQueueItemStack) => {
203207
_console.log(scheduleQueueItemStack);
204-
}
208+
},
205209
);
206210

207211
_console.groupEnd();

addon/src/-internal/deprecations.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BaseContext } from '../setup-context';
22
import { registerDeprecationHandler } from '@ember/debug';
3-
import isPromise from './is-promise';
3+
import isPromise from './is-promise.ts';
44

55
export interface DeprecationOptions {
66
id: string;
@@ -27,11 +27,11 @@ const DEPRECATIONS = new WeakMap<BaseContext, Array<DeprecationFailure>>();
2727
* @return {Array<DeprecationFailure>} the Deprecation Failures associated with the corresponding BaseContext;
2828
*/
2929
export function getDeprecationsForContext(
30-
context: BaseContext
30+
context: BaseContext,
3131
): Array<DeprecationFailure> {
3232
if (!context) {
3333
throw new TypeError(
34-
`[@ember/test-helpers] could not get deprecations for an invalid test context: '${context}'`
34+
`[@ember/test-helpers] could not get deprecations for an invalid test context: '${context}'`,
3535
);
3636
}
3737

@@ -58,11 +58,11 @@ export function getDeprecationsForContext(
5858
*/
5959
export function getDeprecationsDuringCallbackForContext(
6060
context: BaseContext,
61-
callback: () => void
61+
callback: () => void,
6262
): Array<DeprecationFailure> | Promise<Array<DeprecationFailure>> {
6363
if (!context) {
6464
throw new TypeError(
65-
`[@ember/test-helpers] could not get deprecations for an invalid test context: '${context}'`
65+
`[@ember/test-helpers] could not get deprecations for an invalid test context: '${context}'`,
6666
);
6767
}
6868

addon/src/-internal/warnings.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BaseContext } from '../setup-context';
22
import { registerWarnHandler } from '@ember/debug';
3-
import isPromise from './is-promise';
3+
import isPromise from './is-promise.ts';
44

55
export interface WarningOptions {
66
id?: string;
@@ -26,7 +26,7 @@ const WARNINGS = new WeakMap<BaseContext, Array<Warning>>();
2626
export function getWarningsForContext(context: BaseContext): Array<Warning> {
2727
if (!context) {
2828
throw new TypeError(
29-
`[@ember/test-helpers] could not get warnings for an invalid test context: '${context}'`
29+
`[@ember/test-helpers] could not get warnings for an invalid test context: '${context}'`,
3030
);
3131
}
3232

@@ -53,11 +53,11 @@ export function getWarningsForContext(context: BaseContext): Array<Warning> {
5353
*/
5454
export function getWarningsDuringCallbackForContext(
5555
context: BaseContext,
56-
callback: () => void
56+
callback: () => void,
5757
): Array<Warning> | Promise<Array<Warning>> {
5858
if (!context) {
5959
throw new TypeError(
60-
`[@ember/test-helpers] could not get warnings for an invalid test context: '${context}'`
60+
`[@ember/test-helpers] could not get warnings for an invalid test context: '${context}'`,
6161
);
6262
}
6363

@@ -80,7 +80,7 @@ export function getWarningsDuringCallbackForContext(
8080
// * enable a debuggger when a warning by a specific name is encountered via: `/tests/index.html?debugWarnings=some-other-thing` when the
8181
if (typeof URLSearchParams !== 'undefined') {
8282
const queryParams = new URLSearchParams(
83-
document.location.search.substring(1)
83+
document.location.search.substring(1),
8484
);
8585
const disabledWarnings = queryParams.get('disabledWarnings');
8686
const debugWarnings = queryParams.get('debugWarnings');

addon/src/-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* globals Promise */
22

3-
import isFormControl from './dom/-is-form-control';
3+
import isFormControl from './dom/-is-form-control.ts';
44

55
export const nextTick = (cb: () => void) => Promise.resolve().then(cb);
66
export const futureTick = setTimeout;
@@ -15,7 +15,7 @@ export const futureTick = setTimeout;
1515
@param {string} property the property on the object that contains the destroyable array
1616
*/
1717
export function runDestroyablesFor(object: any, property: string): void {
18-
let destroyables = object[property];
18+
const destroyables = object[property];
1919

2020
if (!destroyables) {
2121
return;
@@ -47,7 +47,7 @@ export function isNumeric(n: string): boolean {
4747
@returns {boolean} `true` when the element is visible, `false` otherwise
4848
*/
4949
export function isVisible(element: Element): boolean {
50-
let styles = window.getComputedStyle(element);
50+
const styles = window.getComputedStyle(element);
5151
return styles.display !== 'none' && styles.visibility !== 'hidden';
5252
}
5353

addon/src/application.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Application from '@ember/application';
22

3-
import { getResolver, setResolver } from './resolver';
3+
import { getResolver, setResolver } from './resolver.ts';
44

55
let __application__: Application | undefined;
66

@@ -17,8 +17,8 @@ export function setApplication(application: Application): void {
1717
__application__ = application;
1818

1919
if (!getResolver()) {
20-
let Resolver = (application as any).Resolver;
21-
let resolver = Resolver.create({ namespace: application });
20+
const Resolver = (application as any).Resolver;
21+
const resolver = Resolver.create({ namespace: application });
2222

2323
setResolver(resolver);
2424
}

addon/src/build-owner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Application from '@ember/application';
22
import type { Resolver } from '@ember/owner';
33

4-
import legacyBuildRegistry from './-internal/build-registry';
4+
import legacyBuildRegistry from './-internal/build-registry.ts';
55
import type EmberOwner from '@ember/owner';
66
import type { SimpleElement } from '@simple-dom/interface';
77

@@ -39,7 +39,7 @@ export interface Owner extends EmberOwner {
3939
*/
4040
export default function buildOwner(
4141
application: Application | undefined | null,
42-
resolver: Resolver | undefined | null
42+
resolver: Resolver | undefined | null,
4343
): Promise<Owner> {
4444
if (application) {
4545
// @ts-ignore: this type is correct and will check against Ember 4.12 or 5.1
@@ -51,7 +51,7 @@ export default function buildOwner(
5151

5252
if (!resolver) {
5353
throw new Error(
54-
'You must set up the ember-test-helpers environment with either `setResolver` or `setApplication` before running any tests.'
54+
'You must set up the ember-test-helpers environment with either `setResolver` or `setApplication` before running any tests.',
5555
);
5656
}
5757

0 commit comments

Comments
 (0)