Commit Graph

46 Commits

Author SHA1 Message Date
natecain 951019eacc Make require() compliant with CommonJS Modules/1.1 2013-10-12 13:44:09 -04:00
Jeremy Ruston 5ef4123b3d Revert "Merge pull request #160 from natecain/commonjs"
This reverts commit 661621c3f7, reversing
changes made to d3d72eff1b.
2013-10-12 16:29:20 +01:00
Jeremy Ruston 661621c3f7 Merge pull request #160 from natecain/commonjs
CommonJS Modules/1.1 Conformance
2013-10-12 07:42:26 -07:00
natecain b8c37a26ef Additional improvement to CommonJS Modules support
Now implements (and mostly follows) requirements of Modules/1.1 spec
  implementes only the required "secure sandbox" subset of the spec
  `module` free variable changed from the `moduleInfo` to an id container
  `require` free variable given a "main" property
  boot module scope closed and exported
    this also changes the interface between boot and bootprefix slightly
    (should now be able to create multiple TW instances under node)
 BREAKING CHANGES:
  The tiddlywiki module itself now exports a single constructor function
  Modules which depended on `module` referring to `moduleInfo` will break
  Modules which don't conform to Modules/1.1 will break
    (by attempting to modify require.main or module.id)
2013-10-11 11:32:58 -04:00
Jeremy Ruston c784217009 Missing semi 2013-10-03 14:43:58 +01:00
natecain fbc80e379d Some quick style cleanup to commonjs patches 2013-10-01 17:56:05 -04:00
Jeremy Ruston 48402ed329 Improve comments 2013-09-21 10:06:44 +01:00
natecain 5c92ec3617 Cleaned up some dead/commented in patches. 2013-09-17 22:38:14 -04:00
natecain 881325b7ed 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
2013-09-17 21:10:24 -04:00
Jeremy Ruston 20f06e8eec Ensure that the core plugins inherit their version number from the main `package.info` 2013-08-26 13:28:23 +01:00
Jeremy Ruston d6ec1ea1e5 Remove `plugin` field now that we've got the `plugin-type` field
I've been meaning to remove the `plugin` field for ages.
2013-08-23 18:37:54 +01:00
Jeremy Ruston 9345078926 Refactor boot process to allow for lack of wiki folder
Previously, the command line interface required a wiki folder to be
specified.

This is part of the work to enable TiddlyWiki5 to be used more easily
as a library in other node.js apps
2013-08-21 09:42:51 +01:00
Jeremy Ruston 644d9f9405 Refactor boot sequence
This is the start of making it possible to use TiddlyWiki5 as a library
from a node.js application
2013-08-20 15:17:57 +01:00
Jeremy Ruston be1b16e260 Add a new standard field called "list" that contains a list of tiddler titles 2013-08-07 16:05:56 +01:00
Jeremy Ruston 4765b4a02d Use a more robust check for whether a variable is a date
The simple "instanceof Date" check fails if the Date was made in a
different node.js VM
2013-08-06 15:26:10 +01:00
Jeremy Ruston 586848f5e2 Fix typo
Fixes #113
2013-07-21 21:11:48 +01:00
Jeremy Ruston 4655a7a4d7 Allow wiki folders to contain a themes folder 2013-07-14 23:08:04 +01:00
Jeremy Ruston 5e93778112 Allow a suffix to be specified for indirected files
As well as the existing ability to add a prefix
2013-07-14 23:06:37 +01:00
Jeremy Ruston 4fe408d9d3 Fixed problem with tags that appear more than once in the tag string 2013-07-04 16:55:47 +01:00
Jeremy Ruston f28684d249 Fix problem with JavaScript module tiddlers that are named as system tiddlers
Reported by @boycook
2013-07-03 18:36:51 +01:00
Jeremy Ruston 9ca5f673b9 Minor linting 2013-06-27 09:50:46 +01:00
Jeremy Ruston 02bf8fa469 Fixing 05dc8edc5a properly 2013-06-27 09:43:04 +01:00
Jeremy Ruston 05dc8edc5a Fixed problem with recognising module headers on Windows
Pesky line breaks. Thanks to twitter.com/laheadle
2013-06-27 09:04:55 +01:00
Jeremy Ruston 8063770dae Neater HTML generation in the boot kernel 2013-06-26 23:52:21 +01:00
Jeremy Ruston 90d7d0b3a5 A slightly more concise way of reading package.json 2013-06-26 23:51:57 +01:00
Jeremy Ruston 0be6bf84d1 Extend fieldmodules to include an "editType" field
This will allow us to provide the right HTML5 input element for things
like colours and dates
2013-06-13 09:16:07 +01:00
Jeremy Ruston f285f850d7 Use window.onerror instead of window.addEventListener for error trapping
Now the error trapping works in Firefox
2013-06-13 08:35:05 +01:00
Jeremy Ruston c631916441 Add a global error trapper for the browser
JavaScript errors are invisible unless you've got developer tools open,
which is making it hard for users to report errors. This change makes
JavaScript errors popup a big red alert
2013-06-12 12:40:48 +01:00
Jeremy Ruston c566284158 More consistent naming for the boot tiddlers 2013-05-31 16:53:19 +01:00
Jeremy Ruston 8564602256 Refactor rendertree to simplify context handling
Get rid of the separate renderContext stack and instead have a parent
pointer on renderer nodes. This lets us walk back up the render tree to
resolve context references
2013-05-15 17:32:17 +01:00
Jeremy Ruston 6864251962 Cleaning up content types
Dealt with some inconsistencies
2013-05-13 17:42:07 +01:00
Jeremy Ruston 6b6dbb97a8 Fix typo
Fixes #96
2013-05-07 15:52:21 +01:00
Jeremy Ruston 408fcd8aa3 Add a parser for woff fonts
It's a bit of a hack to have a parser dedicated to fonts. We'll replace
it with a mechanism that handles generic binary data
2013-05-01 13:04:27 +01:00
Jeremy Ruston cb675732b2 More fields hoisted up from plugin.info file into plugin tiddler 2013-05-01 12:01:43 +01:00
Jeremy Ruston 6d455d77cd Update plugin loading mechanism to allow plugins to be unregistered
We still have to explicitly unpack them after registering or
unregistering
2013-04-30 22:56:17 +01:00
Jeremy Ruston 17cfd57390 Start making themes switchable
Separately switch in ordinary plugins and themes. Change the convention
for plugin information to use dashes rather than camel case.
2013-04-28 22:52:26 +01:00
Jeremy Ruston 40ac461ca1 Give plugins a pluginType field
Ordinary plugins have the type "plugin", we'll also have "theme" and
"language"
2013-04-28 18:16:22 +01:00
Jeremy Ruston 31a378b64c Start support for themes
To start with, we move the current stylesheets into a theme plugin
called "Snow White". Wikis have to specify at least one theme in their
`tiddlywiki.info` file. Next we'll add a mechanism for switching
between loaded themes
2013-04-28 09:42:48 +01:00
Jeremy Ruston 7aeeaf81eb Refactor boot.js module execution code
The aim is to expose the underlying cross-platform evalGlobal and
evalSandboxed.

Also adding the capability for a tiddlywiki.files file to specify a
prefix to be added to the text of a file.
2013-04-25 09:05:02 +01:00
Jeremy Ruston 0a37f6bf5b Correct module definition in the browser
The previous logic was preventing modules being executed that weren't
baked into a script tag.
2013-04-10 16:56:17 +01:00
Jeremy Ruston df59269b0d Fixed problem with plugin precedence
We were unpacking plugin tiddlers in arbitrary order, and ensuring that
later plugins didn't overwrite shadow tiddlers from earlier plugins.

Now we'll allow plugins to specify a "pluginPriority" that determines
the load ordering. We also explicitly allow shadow tiddlers from later
plugins to overwrite shadow tiddlers from earlier plugins.

We're setting a base priority on the core plugin, since many plugins
will want to control their loading relative to it.
2013-04-08 18:37:49 +01:00
Jeremy Ruston c0b6be9a13 Correct pesky missing brackets 2013-04-03 21:10:57 +01:00
Jeremy Ruston 0d247cb752 Update shadow tiddler handling to record source plugin tiddler 2013-04-03 13:23:26 +01:00
Jeremy Ruston a75fd3df34 When we deserialize an unknown type as "text/plain" we should mark it with the original type 2013-04-01 18:55:49 +01:00
Jeremy Ruston 63fd149ea9 Relaxed restrictions on the names of constituent tiddlers within plugins
Thus allowing us to give a more sensible title to the core plugin
2013-03-28 17:15:52 +00:00
Jeremy Ruston cd36f594c5 Make the core into a plugin 2013-03-28 17:07:30 +00:00