mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-01 18:17:57 +00:00
Make require() compliant with CommonJS 1.0
This includes potentially breaking changes.
Specifically, before this patch tiddlywiki would default to relative module identifiers
Now, tiddlywiki will only search relative paths if explicitly specified
Additionally, some "defaulted export contexts" were removed
(some modules may make assumptions about context)
Some unit tests were modified slightly from their originals
Tiddlywiki doesn't have a notion of a "main" program's path
Some require calls were explicitly made relative
None of these changes should affect the requirement under test in each case
This commit is contained in:
20
editions/testcommonjs/tiddlers/determinism/submodule/a.js
Normal file
20
editions/testcommonjs/tiddlers/determinism/submodule/a.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*\
|
||||
title: determinism/submodule/a.js
|
||||
type: application/javascript
|
||||
module-type: library
|
||||
|
||||
Determinism require test A
|
||||
|
||||
\*/
|
||||
|
||||
|
||||
var test = require('test');
|
||||
var pass = false;
|
||||
var test = require('test');
|
||||
try {
|
||||
require('a');
|
||||
} catch (exception) {
|
||||
pass = true;
|
||||
}
|
||||
test.assert(pass, 'require does not fall back to relative modules when absolutes are not available.')
|
||||
|
||||
Reference in New Issue
Block a user