Hi Nathan
Here's what's going on. TW on the server uses the Node function
"vm.runInNewContext()" to execute plugin code. It's roughly equivalent to
the browser's "eval()" function.
One of the parameters for runInNewContext is a filename that is used for
error reports. We pass the tiddler title as the filename, which Node uses
to give us nice error messages like this that reference the correct module
tiddler title:
$:/core/modules/startup.js:26
Missing;
^
ReferenceError: Missing is not defined
at Object.exports.startup ($:/core/modules/startup.js:26:1)
at $tw.boot.executeNextStartupTask
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1835:10)
at $tw.boot.executeNextStartupTask
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1839:21)
at $tw.boot.executeNextStartupTask
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1839:21)
at $tw.boot.startup
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1801:11)
at /Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1912:12
at $tw.boot.decryptEncryptedTiddlers
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1381:2)
at $tw.boot.boot
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/boot/boot.js:1910:11)
at Object.<anonymous>
(/Users/jeremyruston/git/Jermolene/TiddlyWiki5/tiddlywiki.js:13:10)
at Module._compile (module.js:456:26)
The behaviour you're reporting would appear to be caused by the debugger
trying to load the source file from the provided filename, and choking.
It's a bit peculiar of the debugger to try to load the file from the
filesystem since it already has the source code that was executed.
I never use Node's own debugger myself - does it actually manage to show
the source code in the debugger? I'll occasionally use node-inspector which
manages to show TW module source code without any problems.
Best wishes
Jeremy
i have been working on understanding how the tiddlywiki core system works
> and i have into a problem. When i run in debug mode, i get lots of output
> like:
>
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\$:\core\modules\startup\commands.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\core\\modules\\startup\\commands.js'
> ,
> syscall: 'open' }
>
>
> this happens for every start up java script file the system tries to run
> in the sandbox environment:
>
> $tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(
> code,context,filename) {
> var sandbox = $tw.utils.extend(Object.create(null),context);
> console.log(filename, context, code);
> vm.runInNewContext(code,sandbox,filename);
> return sandbox.exports;
> };
>
> using the same configuration in run mode, i don't get any of this output.
>
>
> Obviously its because the vm system is choking on the $: syntax at the
> beginning of tiddlers. I was tyring to find any snipet that was cleaning up
> that file name.
>
> I have lots of these:
>
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\$:\core\modules\filters\is\shadow.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\core\\modules\\filters\\is\\shadow.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\$:\core\modules\filters\is\system.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\core\\modules\\filters\\is\\system.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\$:\core\modules\filters\is\tag.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\core\\modules\\filters\\is\\tag.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\$:\core\modules\filters\is\tiddler.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\core\\modules\\filters\\is\\tiddler.js'
> ,
> syscall: 'open' }
>
>
> The server does start up and server requests. Its seems that the v8 java
> script engin is just complaining about the file name. I have put in a small
> fix but that fix has revealed fomr other samall problems with the current
> codebase.
>
>
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\core\modules\startup.js']
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\modules\\startup.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\core\modules\utils\parseutils.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\modules\\utils\\parseutils.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\core\modules\utils\dom.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\modules\\utils\\dom.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\core\modules\parsers\wikiparser\rules\wikirulebase.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\modules\\parsers\\wikiparser\\rules\\wikirulebase.js'
> ,
> syscall: 'open' }
> { [Error: ENOENT, no such file or directory
> 'c:\Users\Nathan\workspace\webstorm\TiddlyWiki5\plugins\tiddlywiki\markdown\markdown.js'
> ]
> errno: 34,
> code: 'ENOENT',
> path:
> 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\plugins\\tiddlywiki\\markdown\\markdown.js'
> ,
> syscall: 'open' }
>
> All of these fail becaus the title filed on the javascript file defines a
> different path than where the plugin actually exists.
> core/modules/startup/startup.js
> core/modules/parsers/parseutils.js
> core/modules/utils/dom/dom.js
> core/modules/parsers/wikiparser/wikirulebase.js
>
> the markdown plugin may have been triggered because im trying use it
> tiddlywiki.files shows
> {
> "tiddlers": [
> {
> "file": "markdown.js",
> "fields": {
> "type": "application/javascript",
> "title": "$:/plugins/tiddlywiki/markdown/markdown.js",
> "module-type": "library"
> }
> }
> ]
> }
>
> which is probably why its throwing an error on running that script.
> markdown wrapper:
> title: $:/plugins/tiddlywiki/markdown/wrapper.js
> the markdown.js doesn't define a title.
>
> Not a really big deal as it doesn't seem to effect the actual running of
> the script.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> For more options, visit https://groups.google.com/d/optout.
>
--
Jeremy Ruston
mailto:[email protected]
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.