-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update TypeScript to latest #630
Changes from all commits
05c8175
37553e8
d9dc521
39a46e8
567e930
1af0019
70d58df
1c33b1b
9181e62
6a3673c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import { join, dirname, resolve, relative, posix, isAbsolute } from 'path'; | |
import { createHash } from 'crypto'; | ||
import { mergeWith, flatten, zip } from 'lodash'; | ||
import { writeFileSync, realpathSync, readFileSync } from 'fs'; | ||
import { compile, registerHelper } from 'handlebars'; | ||
import Handlebars from 'handlebars'; | ||
import jsStringEscape from 'js-string-escape'; | ||
import { BundleDependencies, ResolvedTemplateImport } from './splitter'; | ||
import { BuildResult, Bundler, BundlerOptions } from './bundler'; | ||
|
@@ -32,8 +32,8 @@ const EXTENSIONS = ['.js', '.ts', '.json']; | |
|
||
const debug = makeDebug('ember-auto-import:webpack'); | ||
|
||
registerHelper('js-string-escape', jsStringEscape); | ||
registerHelper('join', function (list, connector) { | ||
Handlebars.registerHelper('js-string-escape', jsStringEscape); | ||
Handlebars.registerHelper('join', function (list, connector) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The API docs only show that kind of usage, and |
||
return list.join(connector); | ||
}); | ||
|
||
|
@@ -56,9 +56,9 @@ function idToModule(id: string) { | |
return moduleIdMap.get(id) ?? id; | ||
} | ||
|
||
registerHelper('module-to-id', moduleToId); | ||
Handlebars.registerHelper('module-to-id', moduleToId); | ||
|
||
const entryTemplate = compile( | ||
const entryTemplate = Handlebars.compile( | ||
` | ||
module.exports = (function(){ | ||
var d = _eai_d; | ||
|
@@ -441,7 +441,7 @@ export default class WebpackBundler extends Plugin implements Bundler { | |
return callback(undefined, 'commonjs ' + request); | ||
} | ||
} catch (err) { | ||
if (err.code !== 'MODULE_NOT_FOUND') { | ||
if ((err as NodeJS.ErrnoException).code !== 'MODULE_NOT_FOUND') { | ||
throw err; | ||
} | ||
// real package doesn't exist, so externalize it | ||
|
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 understand what you're doing here but I don't like the idea of introducing a subtle behaviour change just to work around types here. I would prefer if you worked around the types like you did later in the PR. Something like
(err as unknown as {name: string})
? but don't quote me on it 😂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.
But what's the change in behaviour here? In case of a
SyntaxError
it will always be an instance ofError
, right? And if it's not aSyntaxError
, then the if condition will not be hit either way. If feel this is the cleaner way to do this than to override the types, given that TS is actually right here.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.
@mansona 👆😏