-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20582 from emberjs/internal-coordination
Reducing internal usage of AMD loader
- Loading branch information
Showing
17 changed files
with
449 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
import require, { has } from 'require'; | ||
import { type Test as TestNS } from 'ember-testing'; | ||
import type * as EmberTesting from 'ember-testing'; | ||
|
||
export let registerAsyncHelper: (typeof TestNS)['registerAsyncHelper']; | ||
export let registerHelper: (typeof TestNS)['registerHelper']; | ||
export let registerWaiter: (typeof TestNS)['registerWaiter']; | ||
export let unregisterHelper: (typeof TestNS)['unregisterHelper']; | ||
export let unregisterWaiter: (typeof TestNS)['unregisterWaiter']; | ||
export let registerAsyncHelper: (typeof EmberTesting.Test)['registerAsyncHelper']; | ||
export let registerHelper: (typeof EmberTesting.Test)['registerHelper']; | ||
export let registerWaiter: (typeof EmberTesting.Test)['registerWaiter']; | ||
export let unregisterHelper: (typeof EmberTesting.Test)['unregisterHelper']; | ||
export let unregisterWaiter: (typeof EmberTesting.Test)['unregisterWaiter']; | ||
export let _impl: typeof EmberTesting | undefined; | ||
|
||
if (has('ember-testing')) { | ||
// SAFETY: since `require` is opaque to TS, we need to inform it that this is | ||
// the actual type of what we import. This `require` needs to stay in sync | ||
// with the `import type` statement above. (This cast *increases* safety, | ||
// because the result of `require` is `any`.) | ||
let Test = require('ember-testing').Test as typeof TestNS; | ||
let testingNotAvailableMessage = () => { | ||
throw new Error('Attempted to use test utilities, but `ember-testing` was not included'); | ||
}; | ||
|
||
registerAsyncHelper = testingNotAvailableMessage; | ||
registerHelper = testingNotAvailableMessage; | ||
registerWaiter = testingNotAvailableMessage; | ||
unregisterHelper = testingNotAvailableMessage; | ||
unregisterWaiter = testingNotAvailableMessage; | ||
|
||
export function registerTestImplementaiton(impl: typeof EmberTesting) { | ||
let { Test } = impl; | ||
registerAsyncHelper = Test.registerAsyncHelper; | ||
registerHelper = Test.registerHelper; | ||
registerWaiter = Test.registerWaiter; | ||
unregisterHelper = Test.unregisterHelper; | ||
unregisterWaiter = Test.unregisterWaiter; | ||
} else { | ||
let testingNotAvailableMessage = () => { | ||
throw new Error('Attempted to use test utilities, but `ember-testing` was not included'); | ||
}; | ||
|
||
registerAsyncHelper = testingNotAvailableMessage; | ||
registerHelper = testingNotAvailableMessage; | ||
registerWaiter = testingNotAvailableMessage; | ||
unregisterHelper = testingNotAvailableMessage; | ||
unregisterWaiter = testingNotAvailableMessage; | ||
_impl = impl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export { default as _Ember } from 'ember'; | ||
|
||
import VERSION from 'ember/version'; | ||
import * as _GlimmerSyntax from '@glimmer/syntax'; | ||
|
||
export { default as precompile } from './system/precompile'; | ||
export { default as compile } from './system/compile'; | ||
export { | ||
default as compileOptions, | ||
buildCompileOptions as _buildCompileOptions, | ||
transformsFor as _transformsFor, | ||
} from './system/compile-options'; | ||
export { RESOLUTION_MODE_TRANSFORMS, STRICT_MODE_TRANSFORMS } from './plugins'; | ||
export { EmberPrecompileOptions } from './types'; | ||
|
||
export { preprocess as _preprocess, print as _print } from '@glimmer/syntax'; | ||
export { precompile as _precompile } from '@glimmer/compiler'; | ||
|
||
export { _GlimmerSyntax, VERSION }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
export { default as Test } from './lib/test'; | ||
export { default as Adapter } from './lib/adapters/adapter'; | ||
export { default as setupForTesting } from './lib/setup_for_testing'; | ||
export { default as QUnitAdapter } from './lib/adapters/qunit'; | ||
export * from './lib/public-api'; | ||
import * as EmberTesting from './lib/public-api'; | ||
import { registerTestImplementaiton } from '@ember/test'; | ||
|
||
import './lib/ext/application'; | ||
import './lib/ext/rsvp'; // setup RSVP + run loop integration | ||
import './lib/helpers'; // adds helpers to helpers object in Test | ||
import './lib/initializers'; // to setup initializer | ||
registerTestImplementaiton(EmberTesting); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { default as Test } from './test'; | ||
export { default as Adapter } from './adapters/adapter'; | ||
export { default as setupForTesting } from './setup_for_testing'; | ||
export { default as QUnitAdapter } from './adapters/qunit'; | ||
|
||
import './ext/application'; | ||
import './ext/rsvp'; // setup RSVP + run loop integration | ||
import './helpers'; // adds helpers to helpers object in Test | ||
import './initializers'; // to setup initializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.