-
Notifications
You must be signed in to change notification settings - Fork 18
Conversation
src/main.ts
Outdated
import './Symbol'; | ||
import has from '@dojo/has/has'; | ||
|
||
if (has('host-browser')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kitsonk I couldn't just use the !has()
string here because pepjs
and intersection-observer
error if loaded from node (they expect a browser). I can add the has
checks before the require
statements if you want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk about this, because while TypeScript allows it, we don't want to have a require()
in the code... We may need to use a dynamic import('pepjs');
instead of the require
.
src/support/tslib.ts
Outdated
|
||
import 'tslib'; | ||
|
||
global.__values = function (o: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to override the typescript __values
function because it doesn't handle multibyte strings properly. This will let us use for...of
with multibyte strings.
@@ -0,0 +1,16 @@ | |||
intern.registerLoader((options) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Providing our own loader lets us configure and call our shimAmdDependencies method rather than including all the configuration in the intern config. It probably makes sense to have this loader (or something like it) available for other packages to use. Thoughts?
return intern.loadScript('node_modules/@dojo/loader/loader.js') | ||
.then(() => intern.loadScript('./_build/src/util/amd.js')) | ||
.then(() => { | ||
(<any> require).config(shimAmdDependencies({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding the typings to require
. As soon as I import @dojo/interfaces/loader
, the file turns into an actual module instead of just a plain function and the whole thing breaks down in agony.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(require as any)
and in a test case, the lack of typings is fine, though it would be good to put a comment in the code as to why you are casting.
CI failures from typedoc |
Talked to @kitsonk and @matt-gadd , we agreed that we need to,
If JSDOM doesn't solve the problem ,leave out the DOM polyfills for right now. |
@kitsonk @matt-gadd Made the changes we talked about!
|
I believe I am correct in assuming that this will require our tests and build to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really update the README with details of these changes as they are fairly significant. Other than that, and a nit, looks 💯
return intern.loadScript('node_modules/@dojo/loader/loader.js') | ||
.then(() => intern.loadScript('./_build/src/util/amd.js')) | ||
.then(() => { | ||
(<any> require).config(shimAmdDependencies({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(require as any)
and in a test case, the lack of typings is fine, though it would be good to put a comment in the code as to why you are casting.
@kitsonk , I'll go ahead and update the README with some friendly words. You're correct about needing to |
Added a dependency on dojo/grunt-dojo2#169 . |
Type: feature
The following has been addressed in the PR:
Description:
Polyfills (pepjs and intersection-observer) are now loaded in
main
.An AMD loader configuration mixin is now provided to make loading polyfills easier. It injects a global function that you call to mix in the polyfill/dojo2 loader configuration with your existing configuration:
The intern config for shim has been updated to support this configuration utility (and all loader config has been removed).
Resolves #106