url meteorjs 中的方案 meteor://app/.....

url scheme meteor://app/..... in meteorjs

这个url-scheme/protocol是什么意思?流星://app/.....

我在浏览器开发者工具中打开流星项目时看到了。所有 compiled/transpiled/minified 个文件都在 http://localhost:3000 下。但是,source maps 指向的所有源文件都在另一个名为 meteor://app

的目录中

当我尝试在浏览器中打开这些路径时(或通过在新标签页中选择打开 Link),它说无法打开它们。

流星如何为他们提供服务? chrome 调试工具如何访问? chrome 调试工具如何知道如何处理 "meteor://"?

developer tools with http://location:3000 and meteor://..app

.js.map 文件中的示例: {"version":3,"sources":["meteor://app/password_client.js"],"names"

如果其他人都想知道这是如何工作的......

原始源代码可以包含在源映射(sourcesContent)中。如果你在那里提供它,你可以在 "sources" 中放置你喜欢的任何路径,开发工具将在它自己的文件夹中显示它,如问题中的图片所示。

尝试:

mkdir example
cd example
npm install babel-cli #needed to compile and create source map

#create a hello world js website:
echo "document.write('hello world')  ;  //spaces before ; will be removed in transpiled file" > hello.js
echo "<script src='hello-compiled.js'></script>" > hello.html

#create compiled version and source map
node ./node_modules/babel-cli/bin/babel hello.js --out-file hello-compiled.js --source-maps

cat hello-compiled.js #to see the generated map file
sed -i 's/hello.js/sourcefiles:\/\/sourcesfiles\/hello.js/g' hello-compiled.js.map #change the local url to one with the new protocol
cat hello-compiled.js #to see the map file after the change
#(or just open up the file in an editor and change sources":["hello.js"] to sources":["sourcefiles://sourcefiles/hello.js"]

rm hello.js #get rid of the original so that you don't see it in your sources
#(you can always regenerate it with the echo command above)

google-chrome hello.html #on ubuntu if you have chrome installed
open hello.html #will probably work on osx

##now look at sources in developer tools - you should see source files in theor own folder called sources
#I had to ctrl-shift-r to see all the files
#you should be able to add a breakpoint in the sourcefiles://sourcefiles/hello.js