#15164 closed defect (fixed)
build + dojo/text! module does not take into account internSkipList
Reported by: | Karl Tiedt | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | low | Milestone: | 1.8 |
Component: | Documentation | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Current build system will not ignore templates in the internSkipList UNLESS they still use the deprecated templatePath: property
dojo/text! modules that match the internSkipList are not skipped as they should be.
Change History (6)
comment:1 Changed 9 years ago by
Component: | BuildSystem → Documentation |
---|---|
Priority: | undecided → low |
Status: | new → assigned |
comment:2 Changed 9 years ago by
Rawld, thanks for the quick reply, is there anyway of doing this w/o including all the templates in a new layer?
IE: we need all *.jsp files excluded (and would prefer to not have to track every JSP if/when they change)
comment:5 Changed 9 years ago by
@ktiedt: The full 1.6- internStrings and internSkipList functionality should now be there. There is a slight change in the way items are expressed in internSkipList. Assuming a module contains a legacy cache API application like this:
dojo.cache("dijit", "templates/Dialog.html")
Then, in order to skip interning that string, then legacy internSkipList would look something like this
internSkipList:["dijit:templates/Dialog.html" /* other items, if any */]
As of the 1.7 builder, all references are given as module ids. Thus, the special colon notation is not used. Instead just give the "module" (actually, this is a pseudo module since it's an html file) like this:
internSkipList:["dijit/templates/Dialog.html" /* other items, if any */]
internSkipList defines a set of modules/pseduo-modules that should not be included in the cache provided with a module. Each item in the list may be one of
- the actual [pseudo]module id to skip
- a regular expression that's tested against a potential [pseudo]module-id; if the regex matches, then the item is skipped
- a function that takes the potential module-id to be interned and the reference module and returns true if the module should be skipped, false otherwise.
For example:
internSkipList:[/\.html$/ /* other items, if any */]
Skips all pseudo modules that have the module id ending in ".html"
internSkipList:[ function(mid, referenceModule){ return !referenceModule.tag.amd } /* other items, if any */ ]
Skips everything unless the reference module is tagged as an "amd" module.
Note: a "pseudo-module" is a resource that is located in a package tree, but is not a .js file. Consider...
define(["dojo/text!./some/path/some/file.html"], function(//...
Here the text plugin resolves "./some/path/some/file.html" with respect to the defining module. Say that module is "somePackage/path/to/defining/module". Therefore, the location of the target html file is computed by the loader/builder by first finding the location to the hypothetical module
somePackage/path/to/defining/module/../some/path/some/file.html/x
And then chopping off the /x.js.
This algorithm allows all the power of package mapping configurations, paths, etc. to be used with non-js modules just like regular modules.
comment:6 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|
Hi Karl! Good question, this isn't documented.
The key to keeping something out of a layer is the exclude vector: put a module-id in the exclude vector and that module and its dependency graph will be excluded from the layer. However, you want something slightly different...to exclude a plugin resource. So the trick is to construct a module that includes the plugin resource(s) that you'd like to exclude and then exclude the newly constructed module.
For example, lets say I want to exclude the templates that are found in dijit/Tree, but otherwise want to make dijit/Tree a layer. In this case, I could construct a module definition that looks like this:
Let's say I save this new resource at dijit/treeTemplates so that it resolves to the module-id "dijit/treeTemplates" (of course you could save it anywhere under any name).
With this module in hand I can create a dijit/Tree layer that will exclude the aforementioned templates like this:
The produced dijit/Tree module will be a layer, without the templates.
internSkipList is not used in the 1.7+ builder. AFAIK, it was not well-known nor well-documented. Notice that this design is quite a bit more powerful than the internSkipList idea (which just applied to a single kind of known resource type) since the new design can handle any kind of plugin resource...including plugin semantics that we haven't thought of yet.
Leaving this ticket open as a doc error for now.