-
Notifications
You must be signed in to change notification settings - Fork 94
Conversation
Curated and improved fixes from #155 |
80c5e1c
to
1ab2d36
Compare
1ab2d36
to
5406923
Compare
# programs produce source-mapped stack traces. | ||
RULES_NODEJS_VERSION = "926349cea4cd360afcd5647ccdd09d2d2fb471aa" | ||
# Using a pre-release snapshot to pick up a fix for puppeteer | ||
RULES_NODEJS_VERSION = "0162fdbe8ed986c9b5d5b79e53c98385ddaf6edd" |
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.
don't think you need this anymore?
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.
you mean switch to git_repository from the skylark rules?
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.
nevermind, this is just a fast-forward of master
internal/karma/karma.conf.js
Outdated
const fs = require('fs'); | ||
const tmp = require('tmp'); | ||
|
||
process.env.CHROME_BIN = require('puppeteer').executablePath(); |
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.
in theory the ts_web_test
should allow the user to select one or more browsers,
https://github.com/bazelbuild/rules_typescript/blob/master/internal/karma/ts_web_test.bzl#L22
just to keep in mind, that anything hard-coded will need to be revisited
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'll add a comment to that line explaining it a bit. Karma will just look for CHROME_BIN in the environment if it is configured to use Chrome. If another browser is selected then that value is not used.
internal/karma/karma.conf.js
Outdated
throw new Error(`File not found in MANIFEST: ${f}`); | ||
} | ||
}); | ||
} else { |
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.
do we need to support a case where there is no MANIFEST
?
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.
same as comment below. build_bazel_rules_typescript/external/
prefix is what is needed to match in the manifest and that needs to be dropped so it matches on runfiles.
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 can add a comment here that explains this
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.
Cleaned up. No MANIFEST case is not needed.
internal/karma/karma.conf.js
Outdated
|
||
let requireFiles = [ | ||
TMPL_files | ||
].map((f) => f.replace('build_bazel_rules_typescript/external/', '')); |
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.
why is rules_typescript special here? Could there be other external repos in the files?
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.
that is to handle the two files from ts_web_test.bzl
:
files_entries += [
"build_bazel_rules_typescript/external/build_bazel_rules_typescript_karma_deps/node_modules/requirejs/require.js",
"build_bazel_rules_typescript/external/build_bazel_rules_typescript_karma_deps/node_modules/karma-requirejs/lib/adapter.js",
]
I think its correct. build_bazel_rules_typescript/external/
prefix is what is needed to match in the manifest and that needs to be dropped so it matches on runfiles. in the case of the two files from ts_web_test.bz
, the external workspace is build_bazel_rules_typescript_karma_deps
.
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.
Oh. I took a closer look at the MANIFEST file. I think this code can be improved to get rid the build_bazel_rules_typescript/external/
bit. Will try it out.
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.
Cleaned this up. No build_bazel_rules_typescript/external/
prefix is necessary.
TMPL_files | ||
] | ||
|
||
// files |
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.
stray comment?
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.
yeah. a bit redundant. there was a comment before every other property and I didn't know what else to put.
internal/tsc_wrapped/strict_deps.ts
Outdated
@@ -17,6 +17,7 @@ | |||
|
|||
import * as path from 'path'; | |||
import * as ts from 'typescript'; | |||
import {relative} from './path'; |
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.
again, import * as path from 'path'
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.
this is importing from the local ./path.ts
which provides versions of the four path functions that were introducing forward slashes. the new versions maintain backslashes. you think it would be better as import * as path from './path'
? may be a bit confusing.
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.
yes, that's what I meant, that way we see the familiar path.relative
below, and makes this delta smaller
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.
hmmm. this will conflict with the existing path
imports and uses in compiler_host.ts
and tsconfig.ts
.
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 can just re-export the functions used out of './path'. That will be pretty clean.
internal/tsc_wrapped/tsc_wrapped.ts
Outdated
@@ -12,6 +11,7 @@ import {PLUGIN as strictDepsPlugin} from './strict_deps'; | |||
import {BazelOptions, parseTsconfig} from './tsconfig'; | |||
import {fixUmdModuleDeclarations} from './umd_module_declaration_transform'; | |||
import {debug, log, runAsWorker, runWorkerLoop} from './worker'; | |||
import {resolve} from './path'; |
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.
again
internal/tsc_wrapped/tsconfig.ts
Outdated
@@ -17,6 +17,7 @@ | |||
|
|||
import * as path from 'path'; | |||
import * as ts from 'typescript'; | |||
import {resolve, normalize} from './path'; |
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.
again
import * as ts from 'typescript'; | ||
|
||
import {parseTsconfig} from './tsconfig'; | ||
import {resolve} from './path'; |
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.
again
internal/tsc_wrapped/worker.ts
Outdated
@@ -1,4 +1,4 @@ | |||
import * as path from 'path'; | |||
import {resolve} from './path'; |
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.
again
@gregmagolan, does this address #152? |
Nope. Although there is a fix for that that @alexeagle has submitted internally |
@achew22 Its been merged in. Fixed on rules_typescript master now. Commit is: Workaround for microsoft/TypeScript#22208 |
Okay I got @mprobst on chat, here is the code review:
|
/cc @alexeagle