mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
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>
This commit is contained in:
committed by
Commit Bot
parent
98b339fb3c
commit
455069ae90
+1
@@ -0,0 +1 @@
|
||||
karma-sourcemap-loader
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" />
|
||||
</project>
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/karma-sourcemap-loader.iml" filepath="$PROJECT_DIR$/.idea/karma-sourcemap-loader.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="53d6c355-a19f-48b2-b6f9-7bf5ad35fa25" name="Default" comment="" />
|
||||
<ignored path="karma-sourcemap-loader.iws" />
|
||||
<ignored path=".idea/workspace.xml" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
||||
<component name="CreatePatchCommitExecutor">
|
||||
<option name="PATCH_PATH" value="" />
|
||||
</component>
|
||||
<component name="DaemonCodeAnalyzer">
|
||||
<disable_hints />
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FavoritesManager">
|
||||
<favorites_list name="karma-sourcemap-loader" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="README.md" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider editor-type-id="MarkdownPreviewEditor">
|
||||
<state />
|
||||
</provider>
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="54" column="58" selection-start="1407" selection-end="1407" vertical-scroll-proportion="-29.37037" vertical-offset="179" max-vertical-offset="1080">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="index.js" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/index.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="18" column="36" selection-start="788" selection-end="788" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="954">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="package.json" pinned="false" current="true" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="2" column="21" selection-start="59" selection-end="59" vertical-scroll-proportion="0.039955605" vertical-offset="0" max-vertical-offset="901">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="changedFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/README.md" />
|
||||
<option value="$PROJECT_DIR$/package.json" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="y" value="22" />
|
||||
<option name="width" value="1636" />
|
||||
<option name="height" value="1028" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectReloadState">
|
||||
<option name="STATE" value="0" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="karma-sourcemap-loader" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="karma-sourcemap-loader" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="karma-sourcemap-loader" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="options.lastSelected" value="web-ide.project.structure" />
|
||||
<property name="options.splitter.main.proportions" value="0.3" />
|
||||
<property name="options.splitter.details.proportions" value="0.2" />
|
||||
<property name="options.searchVisible" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<list size="0" />
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="53d6c355-a19f-48b2-b6f9-7bf5ad35fa25" name="Default" comment="" />
|
||||
<created>1397815966441</created>
|
||||
<updated>1397815966441</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="22" width="1636" height="1028" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="Vcs.Log.UiProperties">
|
||||
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
||||
<collection />
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="myTodoPanelSettings">
|
||||
<TodoPanelSettings />
|
||||
</option>
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider editor-type-id="MarkdownPreviewEditor">
|
||||
<state />
|
||||
</provider>
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="54" column="58" selection-start="1407" selection-end="1407" vertical-scroll-proportion="-29.37037" vertical-offset="179" max-vertical-offset="1080">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/index.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="18" column="36" selection-start="788" selection-end="788" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="954">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="2" column="21" selection-start="59" selection-end="59" vertical-scroll-proportion="0.039955605" vertical-offset="0" max-vertical-offset="901">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Sergey Todyshev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
# karma-sourcemap-loader
|
||||
|
||||
> Preprocessor that locates and loads existing source maps.
|
||||
|
||||
## Why
|
||||
|
||||
When you use karma not in isolation but as part of a build process (e.g. using grunt
|
||||
or gulp) it is often the case that the compilation/transpilation is done on a previous
|
||||
step of the process and not handled by karma preprocessors. In these cases source maps
|
||||
don't get loaded by karma and you lose the advantages of having them.
|
||||
|
||||
## How it works
|
||||
|
||||
This plug-in supports both inline and external source maps.
|
||||
|
||||
Inline source maps are located by searching "sourceMappingURL=" inside the javascript
|
||||
file, both plain text and base64-encoded maps are supported.
|
||||
|
||||
External source maps are located by appending ".map" to the javascript file name.
|
||||
So if for example you have Hello.js, the preprocessor will try to load source map from
|
||||
Hello.js.map.
|
||||
|
||||
## Installation
|
||||
|
||||
Just write `karma-sourcemap-loader` as a devDependency in your `package.json`.
|
||||
```json
|
||||
{
|
||||
"devDependencies": {
|
||||
"karma-sourcemap-loader": "~0.2"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or just issue the following command:
|
||||
```bash
|
||||
npm install karma-sourcemap-loader --save-dev
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The code below shows a sample configuration of the preprocessor.
|
||||
```js
|
||||
// karma.conf.js
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
preprocessors: {
|
||||
'**/*.js': ['sourcemap']
|
||||
}
|
||||
});
|
||||
};
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Thanks to @goldibex for adding inline source maps support.
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var createSourceMapLocatorPreprocessor = function(args, logger, helper) {
|
||||
var log = logger.create('preprocessor.sourcemap');
|
||||
|
||||
log.debug('loaded');
|
||||
|
||||
return function(content, file, done) {
|
||||
function sourceMapData(data){
|
||||
file.sourceMap = JSON.parse(data);
|
||||
done(content);
|
||||
}
|
||||
|
||||
function inlineMap(inlineData){
|
||||
var data;
|
||||
var b64Match = inlineData.match(/^data:.+\/(.+);base64,(.*)$/);
|
||||
if (b64Match !== null && b64Match.length == 3) {
|
||||
// base64-encoded JSON string
|
||||
log.debug('base64-encoded source map for', file.originalPath);
|
||||
var buffer = new Buffer(b64Match[2], 'base64');
|
||||
sourceMapData(buffer.toString());
|
||||
} else {
|
||||
// straight-up URL-encoded JSON string
|
||||
log.debug('raw inline source map for', file.originalPath);
|
||||
sourceMapData(decodeURIComponent(inlineData.slice('data:application/json'.length)));
|
||||
}
|
||||
}
|
||||
|
||||
function fileMap(mapPath){
|
||||
fs.exists(mapPath, function(exists) {
|
||||
if (!exists) {
|
||||
log.debug('sourcemap file does not exist');
|
||||
done(content);
|
||||
return;
|
||||
}
|
||||
log.debug('test');
|
||||
fs.readFile(mapPath, function(err, data) {
|
||||
if (err){ throw err; }
|
||||
|
||||
log.debug('external source map exists for', file.originalPath);
|
||||
sourceMapData(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var match = content.match(/#\s*sourceMappingURL=(.+)$/m);
|
||||
log.debug(match);
|
||||
if (match !== null && match.length == 2) {
|
||||
var mapUrl = match[1];
|
||||
if( /^data:application\/json/.test(mapUrl) ){
|
||||
inlineMap(mapUrl);
|
||||
} else {
|
||||
fileMap(path.resolve(path.dirname(file.path), mapUrl));
|
||||
}
|
||||
|
||||
} else {
|
||||
fileMap(file.path + ".map");
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
createSourceMapLocatorPreprocessor.$inject = ['args', 'logger', 'helper'];
|
||||
|
||||
// PUBLISH DI MODULE
|
||||
module.exports = {
|
||||
'preprocessor:sourcemap': ['factory', createSourceMapLocatorPreprocessor]
|
||||
};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"author": {
|
||||
"email": "gabriele.genta@gmail.com",
|
||||
"name": "Gabriele Genta"
|
||||
},
|
||||
"description": "Karma plugin that locates and loads existing javascript source map files.",
|
||||
"keywords": [
|
||||
"karma-plugin",
|
||||
"karma-preprocessor",
|
||||
"source-maps",
|
||||
"javascript"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "karma-sourcemap-loader",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:demerzel3/karma-sourcemap-loader.git"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
||||
Reference in New Issue
Block a user