Commit Graph
302 Commits
Author SHA1 Message Date
Tim van der Lippe 846c6a1466 Remove unused global references in workspace-legacy.js
These are not used in our layout tests or module.json files

R=aerotwist@chromium.org

Bug: 1064958
Change-Id: Ia80d231758e202de92daa2bf53ae9c0e5476f545
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2122141
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-27 12:21:11 +00:00
Tim van der Lippe d25ae40485 Remove unused scripts files
They are referenced nowhere and not used in the current workflows.

R=yangguo@chromium.org

Change-Id: Ie1dd6e8afc352aa5f30a69a863199c21bf4c99f7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2122348
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-26 16:58:20 +00:00
Jack Franklin d3f547209d Component bridges generation
This CL introduces a script to generate `_bridges.js` files for TypeScript web components.

For further details see:

* `scripts/component_bridges/README.md` in this CL.
* Modernising UI components: https://docs.google.com/document/d/1Asq9BDFFvnsqhDbpu2Ez92pugPN2-8nq50O6sNO0SpY/edit
* Building bridges to a TypeScript world: https://docs.google.com/document/d/1qpa5QSSHrvvo_w73GV0hOJRug4N0_9JfFDw01d-NaCE/edit#heading=h.7nki9mck5t64

Change-Id: I95656acd6d22f5e09d178875dd3bcaf47da75a9c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2108761
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-03-26 11:36:00 +00:00
Paul Lewis ae5e8fb631 Adds support for e2e parallelization
Change-Id: I9af281bc40223a5ceb2a6f71ce247970beea4b02
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116050
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-25 16:45:33 +00:00
Mathias Bynens 88e8f15748 Enable no-case-declarations lint rule
Lexical declarations in `case` and `default` clauses are a footgun,
since they are visible in the entire switch block, but they only
get initialized upon assignment, which only happens if the relevant
`case` is actually reached.

To ensure that such lexical declarations only apply to the current
`case` (which is usually the intention), `case` clauses containing
them should be wrapped in curly braces to create an explicit block.

More information:
https://eslint.org/docs/rules/no-case-declarations

Change-Id: I63d9341fcd76d4b9ce8281bd0e6573b886577f08
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2119685
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-03-25 15:26:13 +00:00
Tim van der Lippe 6021e3e22e Automatically fix imports with missing file extensions
Missing file extensions are a runtime error in the browser, even though
TypeScript accepts imports without a file extension.

R=jacktfranklin@chromium.org

Bug: 1011811
Change-Id: I5c5abac2c45be7c8151340cc3981c74c89e96fb7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116444
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-24 12:19:42 +00:00
Tim van der Lippe 44d389ace1 Relax import style rules for inner-module imports
Since imports within a module can be of any style, relax the rules
to also allow `import * as` for all files, not only ARIAutils.js

R=sigurds@chromium.org,jacktfranklin@chromium.org

Change-Id: I9cd8973176c200c72a6009496e07404b959435a6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116442
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-24 11:28:42 +00:00
Simon Zünd f69667700c Emit real TypeScript enums for inline declared protocol enum types
Commands, Events and Object types can declare "inline enums" to
restrict the possible values of a 'string' field.

Example field:

  referrerPolicy: ('unsafe-url'|'...'|'...')

To enable type-checking with TypeScript and stay compatible with
existing code, we now generate explicit enums. The naming scheme
for the enum names is adapted from code_generator_frontend.py
and needs to always match.

Example generated enum for the above code:

  export enum RequestReferrerPolicy {
    UnsafeUrl = 'unsafe-url',
    NoReferrerWhenDowngrade = 'no-referrer-when-downgrade',
    NoReferrer = 'no-referrer',
    Origin = 'origin',
    OriginWhenCrossOrigin = 'origin-when-cross-origin',
    SameOrigin = 'same-origin',
    StrictOrigin = 'strict-origin',
    StrictOriginWhenCrossOrigin = 'strict-origin-when-cross-origin',
  }

This is necessary as we didn't had any type for this enum before
but existing code was using

  Protocol.Network.RequestReferrerPolicy

as a type in JSDoc.

R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: I4b4aa04b69fa4d7bf3b79ad97d61d4e3bfb7e228
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2113374
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-23 15:47:21 +00:00
Simon Zünd c385b48e5d Emit TypeScript enums in protocol.d.ts for Protocol enums
Instead of

    export type MixedContentType = ('blockable'|'...'|'none');

we know emit

    export enum MixedContentType {
      Blockable = 'blockable',
      OptionallyBlockable = 'optionally-blockable',
      None = 'none',
    }

This is necessary as existing JavaScript code accesses these
enums using

   Protocol.Security.MixedContentType.None

R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Id4bf2c1333affcdc4df37a43bf95379700e3e9d0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2113373
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-23 15:17:31 +00:00
Tim van der Lippe 5d2d79b814 Fix presubmit check to always run when generated files change
We are changing the build output in the generated file, but were not
properly checking that these were changed, as the presubmit check
was ignoring files in the `front_end/generated` folder.

Also fix the issue where the InspectorBackendCommands.js would be
changed to not emit the typedef.

R=szuend@chromium.org

Bug: 1011811
Change-Id: I2e09bce9cae69f4191d93de177b5ab5bb7da46c0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2115630
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-23 12:34:41 +00:00
Tim van der Lippe 1511efc125 Write .clang-format when updating node_modules
This makes sure that whenever `npm run install-deps` is run, the
.clang-format file is also written (as we don't want clang-format
to format the node_modules folder).

R=aerotwist@chromium.org,jacktfranklin@chromium.org

Change-Id: I4d3d1f7241833f622575ae237792fbacdc6e02ea
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2112366
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-20 12:11:07 +00:00
Philip Pfaffe 5fcacdc888 Implement Mock Plugin Test
E2E test language plugins using a mock plugin.

Change-Id: Ie2c7abaeeb2038b1aeaf58e965caff3648bc4a47
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2035938
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-03-19 14:32:47 +00:00
Simon Zünd b6414c9da6 Rename legacy global for protocol_client to ProtocolClient
R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Ibe6de479bcc18d28dceb7fa2266388ca0d65eae2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107558
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2020-03-19 12:48:42 +00:00
Simon Zünd 182134236e Rename namespace import for protocol_client to ProtocolClient
R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Idf3e9eb8f6d52db78f563de53b7576ec6c9b9cdc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107557
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-19 12:08:52 +00:00
Tim van der Lippe 640c9f03b6 Update jsdoc_validator
These usages are actually wanted. We *do* want to use document.createElement.
Therefore, remove these usages from the validator to unblock the bridges work
as well we other typescriptification work.

R=jacktfranklin@chromium.org

Bug: 1011811
Change-Id: I3c65ef2b53d056fe8ae6aa42149c18da4271502e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2108762
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-19 10:51:02 +00:00
Simon Zünd 3b0c540211 Rename front_end/protocol to front_end/protocol_client
This CL is part of the work to switch over to the TypeScript compiler
for type checking.

R=tvanderlippe@chromium.org

Bug: chromium:1011811
Change-Id: Ic709a193b252df7e9027c00cf20d8afe525a215a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107539
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-18 18:06:20 +00:00
Tim van der Lippe 8fa65441f9 Add filesystem TypeScript types
We use these types for all of our interactions with the local filesystem
API's and they don't normally ship with TypeScript library definitions.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Add node_module

Bug: 1011811
Change-Id: I41ae8faf8cce289c86a6795ff76d8a10b5b3609d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2108760
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-18 17:58:39 +00:00
Tim van der Lippe 6d51bf00ea Factor out Runtime to root/Runtime.js
front_end/Runtime.js was doing multiple things: it was instantiating
side-effecty descriptors and initializing applications, as well as
storing all state for the modules/extensions, etc...

To support proper ES Modules, we need to separate these. root/Runtime.js
contains simple classes that store the data and can be retrieved, as well
as some helper functions that will load the respective data.

The RuntimeInstantiator.js code includes the start functions used in the
entrypoints themselves. They will use an instance of the Runtime to
properly load the application.

Along the way, I also fixed various TypeScript errors, mostly around
incorrect or missing type definitions.

R=aerotwist@chromium.org,jacktfranklin@chromium.org

Bug: 1011811
Change-Id: If3ddea9267813691b3faeb6ea4b0cf64edbde1f4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107523
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-18 12:19:29 +00:00
Jack Franklin 02d03f4ef2 Revert "Add tsickle as a node dep"
This reverts commit 82dc0cef49.

Reason for revert: We don't think that we're going to use tsickle yet. Apologies - I made this CL a little hastily in hindsight.
Original change's description:
> Add tsickle as a node dep
> 
> We need it to convert from TypeScript to Closure to generate bridges
> whilst we migrate from Closure to TS.
> 
> DISABLE_THIRD_PARTY_CHECK=adding tsickle
> 
> Change-Id: I0bb28ecd6f5f6f131a59a02c8833aebd7ae92471
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107215
> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>

TBR=tvanderlippe@chromium.org,jacktfranklin@chromium.org

Change-Id: Iee3631911650c03df4c18d07969b94b2d797cb5a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107530
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-03-18 11:15:28 +00:00
Jack Lynch b110942f5c Ensure that all actions have categories
To support custom shortcuts, this updates the module.schema.json to
require actions to have categories and adds categories to existing
actions. It also renames the existing "DevTools" category to "Global."

Custom shortcuts design doc: https://docs.google.com/document/d/1oOPSWPxCHvMoBZ0Fw9jwFZt6gP4lrsrsl8DEAp-Hy7o/edit#heading=h.2xpjzz3fl1ju

Bug: 174309
Change-Id: I0860f040e19502b4c47301356b52a2f12166dee5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2101972
Reviewed-by: Shane Clifford <shanejc@microsoft.com>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
2020-03-18 00:50:58 +00:00
Tim van der Lippe c19ea32ca5 Fix protocol generator formats
- The protocol files were generated without license headers
- There were whitespace issues in the .d.ts files

Change-Id: I19572989360a4a537fdfe829f212587ae70e180f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107217
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2020-03-17 12:34:08 +00:00
Jack Franklin 82dc0cef49 Add tsickle as a node dep
We need it to convert from TypeScript to Closure to generate bridges
whilst we migrate from Closure to TS.

DISABLE_THIRD_PARTY_CHECK=adding tsickle

Change-Id: I0bb28ecd6f5f6f131a59a02c8833aebd7ae92471
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107215
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-17 11:40:19 +00:00
Paul Lewis 2d7d65c5e8 [global] Remaps self.Common.settings
This CL changes references to self.Common.settings (the global
instance of SDK.Common.Settings) over to
Common.Settings.Settings.instance(). To keep both TypeScript and
Closure happy we must make a method on the Settings class itself,
since it only allows private constructors to be accessed by static
methods on the class.

Bug: 1058320
Change-Id: I04afc8caf64acf29cdda13ef03ad05cfff4786a1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091450
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-16 22:04:07 +00:00
Tim van der Lippe 60bc8888bf Remove jsconfig configuration files
These files were used in the pre-ES module module era, to instruct
editors like VS Code to resolve symbols. However, since we are in ES
modules land we explicitly *don't* want this resolution. By removing
suport for jsconfig, the editor will now warn before hand on un-imported
symbols. This should reduce the risk of accidentally using the global
symbol rather than the import.

After this change, there will be numerous `jsconfig.json` in the
repository. You are recommended to `git add . && git reset --hard` to
remove these from your local checkout.

Most files will now see a lot of red squiggles with errors, which is to
be expected, as TypeScript does not understand many of the globals. I
have declared `ls` in the globals to at least suppress these, as well as
fix the definition of UIString. These seem to be the most prominent.

All other usages will still need fixing before the files in question can
be typescriptified. However, we do hope that with this change, it is
more difficult to check in new code that is not compliant with
TypeScript already.

Bug: 1006759
Change-Id: I6591e73d66c845a2160b843b627c1adcb1389c24
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2098602
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2020-03-16 17:13:36 +00:00
Tim van der Lippe c6be644636 Remove run_old_devtools scripts
These were originally introduced in
https://chromium-review.googlesource.com/c/chromium/src/+/1298617 as
part of https://bugs.chromium.org/p/chromium/issues/detail?id=898245
Looking at the context of both of these, they were part of an old
workflow to verify compatibility with an old version of DevTools.

Since this workflow is no longer relevant for us, I propose to remove
these scripts to reduce maintenance burden.

Change-Id: Ic96506fb42b9e2b845ab359645ee443e2e90bc92
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2098623
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
2020-03-16 16:47:46 +00:00
Tim van der Lippe 455069ae90 Add karma-sourcemap-loader to node_modules
This will be used to load sourcemap files for TypeScript unittests.

R=aerotwist@chromium.org,jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Add node_module

Bug: 1061125
Change-Id: I13cfdbe078402b02563e7843595016a14bf93617
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2105436
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-16 16:40:16 +00:00
Paul Lewis 4d806b9daa Updates npm_test to work on Windows
process.env.PWD does not exist on Windows, so we default to asking for
the current working directory there instead.

TBR=tvanderlippe@chromium.org

Change-Id: I35ba848aee686ed066bf095afa3d05b45f527139
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2102715
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-03-13 15:03:55 +00:00
Tim van der Lippe 2a4ae2bdc3 Run ESLint only on affected files for regular uploads
For most of the PRESUBMIT invocations, the CL in question does not
change anything with regards to ESLint. Therefore, we can skip doing the
full check and only perform the check on relevant JavaScript and
TypeScript files.

However, if we do change the ESLint configuration (via one of the
involved build scripts/configuration files), we should run the full
check to make sure we are compliant.

`npm run check-lint` will still run the full lint check.

This saves about 15 seconds on a regular PRESUBMIT invocation, scaling
with the number of files changed.

R=jacktfranklin@chromium.org,aerotwist@chromium.org

Change-Id: I9c1bb055274bfa1d8cc47c9039a1196c92eba399
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097993
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-12 16:18:05 +00:00
Tim van der Lippe 4a8441c385 Port license header check to ESLint
This improves the PRESUBMIT performance as we can rely on the AST
parsing of ESLint, meaning we don't have to parse AST twice.

It also allows us to use the nice `--fix` solution to insert the proper
license header in the files.

This shaves an expected 5 seconds of the presubmit time
(non-scientifically computed based on 2 uploads).

Change-Id: I5c53e9b232585f9ec46f86b36557c50bf80f7add
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097992
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-12 16:08:22 +00:00
Jack Franklin 8297869795 Generate protocol.d.ts files in devtools-frontend
We need this to be able to migrate parts of the frontend over to
TypeScript that use the Protocol.

We can generate this automatically via a script [1] from the
devtools-protocol repository on GitHub that we've pulled into our repo
and tweaked slightly.

The files are commited and can be easily re-generated should the PDL
files be updated.

DISABLE_THIRD_PARTY_CHECK=expected ts_library changes

[1]: https://github.com/ChromeDevTools/devtools-protocol/tree/master/scripts

Change-Id: I7115fdf109487a82edcaaf7f9984e8ec587d8b04
Bug: 1011811
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096703
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-12 15:18:42 +00:00
Tim van der Lippe c2cb4301c9 Add missing license headers
In a follow-up CL we will be porting the license header check to ESLint.
This allows us to add missing license headers for TypeScript-authored
files. The script found some missing license headers already, which this
CL adds.

Change-Id: Id5041813281d2a7151297f9ed29baabc1cfd85af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097991
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-12 14:53:52 +00:00
Tim van der Lippe ba26b2b503 Run ESLint on the scripts directory
We weren't running ESLint on this directory and, as it turns out, there
are quite a few linter errors in this folder.

R=jacktfranklin@chromium.org

Change-Id: Ic6cb9f6ad4858f69114e0c433a954041215b49e2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096705
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-11 14:47:51 +00:00
Jack Franklin 6a14c8da7c Allow third_party DEPs to be exempt from import rules
We want to use the same rules for importing from third_party but
ultimately if the dep isn't quite structured in a way that lets us do
that we need to be able to make it exempt, which is what this CL does,
starting with `lit-html`.

We don't import `lit-html` on master yet but we do in the Breadcrumbs CL
[1] and we're unable to import everything from the root `lit-html.js`
file as it doesn't expose everything we need.

[1]:
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2067066

Change-Id: I0678d5ee75e8dcb376cc40df6f9b37f32fbb557d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097983
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-11 14:14:06 +00:00
Jack Franklin eaa866a0a1 Allow TypeScript to import ls directly
(Initially made this change on the breadcrumbs CL but pulled it out).

In the components TypeScript world we want it to be really easy and
obvious which function to use for localized strings. We agreed that `ls`
is the best option.

Right now not all of `Common` is TypeScriptified and that means that
from a TypeScript file you can't do `import * as Common ...`. So to get
around this we create a new module, `Common/ls.ts` which literally
re-exports `ls` from `Common/UIString`.

We then update the ES modules importing rules to special case that:

1. IF you are in a TypeScript file
2. AND the import ends in `common/ls.js`
3. then it's OK - else you have to stick to the usual rules.

I'm sure this will change over time as we migrate more to TypeScript and
build more components but this is a good starting point for enabling
easier localization from TypeScript components.

Additionally we can swap the export in `common/ls.ts` out for a newer
one if we decide to change how it works without changing all the
callsites.

Change-Id: I226525b2e606cf70a50ef37a4d17aa37b18a34ab
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097978
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-11 11:52:36 +00:00
Tim van der Lippe d6c33c4cd6 Add custom ESLint rule to check ES import statements
This makes sure that the guidance of
https://docs.google.com/presentation/d/1KaTDaKEcLmgv3Wum79gPP9mv9x2fm3kuEgx_b8wLVug/edit?usp=sharing
will be caught during build time. This prevent issues where duplication
of code in combination with Rollup can cause runtime issues.

Bug: 1060003
Change-Id: Ic8c8dfcc4e9890592791adc23044033b1aa3ca1b
Fixed: 1060123
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096700
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-10 17:33:13 +00:00
Tim van der Lippe 835724b419 Add eslint-plugin-rulesdir to node_modules
This plugin needs to be used to write our own custom ESLint plugins that
live in our repository. It replaces the `rulesdir` CLI option, as the
solution of putting it in `.eslintrc.js` is compatible with code editor
plugins.

I also discovered that we were incorrectly running clang-format on
`node_modules`, as I recently fixed the PRESUBMIT. To make sure that
doens't happen again, add a `.clang-format` that disables the formatting
in that folder.

DISABLE_THIRD_PARTY_CHECK=Add new node_module

Bug: 1060123
Change-Id: Ib2c0d23f499604deeea51cb06192bce3a7aa89af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096449
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-10 17:20:54 +00:00
Jack Franklin 86d57122be Extend GRDP tooling with TypeScript support
This CL introduces support for parsing and pulling translations out of
`*.ts` files.

It introduces code to parse a TypeScript AST to look for `ls` calls and
pass them back into the existing GRDP tooling.

As a purposeful limitation, it _only looks for `ls` calls_.

Change-Id: I3f91793165e11f0382d6266f4e2c2443701b299a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2095295
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-10 11:50:43 +00:00
Jack Franklin 539b4d3bf5 Exclude front_end/third_party from GRDP file checks
No files in here are able to call our language funcs so there's no point
wasting effort checking them.

Change-Id: I006cb81a32a39fd099ea44869335dd81a8d3f734
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2094122
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-10 11:14:23 +00:00
Changhao Han 1e4c9dd21a use "alias_for" from css_properties.json5 to get canonical css property names
Bug: chromium:1039620
Change-Id: I3be48ee7da959fa500c8775323aa416de520353e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2089908
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
2020-03-09 21:49:48 +00:00
Jack Lynch 9e74255c7e Update module.schema.json and add missing action titles
A previous CL [1] added titles to most actions but missed several. This
CL rectifies that and updates the schema to require actions for titles.

[1] https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2085476

Bug: 174309
Change-Id: Ie1a3226450a903c6ac3344ddad424e9a187ef3a8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091055
Reviewed-by: Brian Cui <brcui@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
2020-03-09 18:08:38 +00:00
Tim van der Lippe 6a0c2e2f5b Sort generated property values on keys
When dumping the JSON object, we have to ensure that the keys are in the
same order. Otherwise, the generated file is non-deterministic.

We hit this issue when we made a subsequent update in
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2089908
where we are adding an additional dictionary to the file, causing
failures on Windows.

R=changhaohan@chromium.org

Bug: 1039620
Change-Id: Iec33962d4fd5dff461bc2930db54e5c85ce645b7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2095300
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2020-03-09 18:00:38 +00:00
Tim van der Lippe 8bdbc7af8c Use rollup to bundle module entrypoints
Settting the Ninja arg `is_debug` will retain the old behavior. However,
setting that flag to `false` will start using Rollup. Rollup will bundle
everything into an entrypoint, but will avoid bundling module
dependencies.

For example, if a file in `ui` depends on `common`, then everything in
`ui` will be bundled into `ui/ui.js`. But, it will retain all imports to
`common` as `import * as Common from '../common/common.js';`.

This also caught an issue with misconfiguration in the
wasmparser_worker, which should import the files directly and can't use
it in the dependencies array of the module.json

Lastly, the BUILD.gn definition is significantly cleaned up. In the
process of doing all this work, I discovered that we can simply use
`foreach` to iterate through all source files. This removes the
duplication of both `fron_end` and `$resources_out_dir` and
significantly reduces the amount of clutter in BUILD.gn.

As such, update check-gn.js to check for the correct GN variables.

roll CodeMirror: ignore

Bug: 1046596
Change-Id: I7dcda7949e79e001c8a11307dc902f96a8fa6696
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2089906
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-09 10:59:37 +00:00
Tim van der Lippe 333ffc2274 Cleanup linter check
- Remove duplicate handling of subprocesses
- Remove indirection of js_lint (we can simply name it main)

These cleanups allow us to later optimize the linting step by only
linting changed files.

R=aerotwist@chromium.org

Change-Id: Ifb8fdb3a25ea04a4879d434d85ff44aa17dae012
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2088091
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-09 10:57:07 +00:00
Jack Franklin 9d8c9bf34d Remove Sinon and associated deps
We thought we'd use Sinon for spying but we've since moved away from
that as an approach.

DISABLE_THIRD_PARTY_CHECK=removing sinon, changes expected

Change-Id: I47f652b6ba6d08b0d3e53dfc2a1a8ee79535901d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091447
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2020-03-06 14:33:13 +00:00
Jack Lynch 61f8ad8b69 Add titles for all actions
This CL adds titles to the actions that don't yet have them (most do) to
support future custom keyboard shortcut work.

Bug: 174309
Change-Id: Ic2aa408c82d863369427f13e5330530d948138b0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2085476
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Reviewed-by: Brian Cui <brcui@microsoft.com>
2020-03-05 21:09:45 +00:00
Tim van der Lippe f5b833c6d2 Remove useless content read
This logic was only performed for the shell.js, which is essentially
empty. As such, we can remove it.

Bug: 1046596
Change-Id: I0218e0a7264594b588080e36c73b498c06e0d160
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2035793
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-05 16:01:24 +00:00
Tim van der Lippe a092065b44 Remove unused methods
They are not referenced anywhere in this file

Bug: 1046596
Change-Id: If9a76df7ee83d2d95a3c8185371a01fee71fa283
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2035792
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-05 15:42:13 +00:00
Tim van der Lippe b0d65f1b3c Extract protocol generation to separate script
This allows us to add an npm command that does the same thing. This is
necessary to support the workflow of making changes in the pdl during
development.

You can regenerate the relevant protocol files with
`npm run generate-protocol-resources`. Note that the files it generates
are not formatted, but on presubmit it will both format and lint the
files to the correct notation. However, that should not impact the
workflow of making changes to the protocol files and testing their
behavior.

R=sigurds@chromium.org

Change-Id: I87c06183c8842d8643c4647cb1519850d75bd46d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2088093
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
2020-03-05 12:21:12 +00:00
vidorteg 80c894d4a1 Sanitizing check_localizable_resources description
Non-alphanumeric characters in the grdp description are interpreted as
part of the regular expression, this CL removes the description from
the matching process, as the ID is assumed to be unique.

Change-Id: I6463912e3b87e11f58ac6b2aa0e060353b12bd0d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2086431
Reviewed-by: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
2020-03-05 02:04:39 +00:00
Tim van der Lippe e894e9c586 Stop rewriting html entrypoints
This adds the necessary ES imports to the various entrypoints to
properly load their dependencies. This means that we can stop rewriting
the HTML entrypoints and simply copy them over to the build directory.

Bug: 1046596
Change-Id: If1182ed051a22cc2bb0c77456456ab039f63cec2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2035791
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-04 17:19:45 +00:00