This repository was archived by the owner on Jul 13, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,43 @@ Running the application:
246
246
NodeJS test
247
247
```
248
248
249
+ ### Tracing API
250
+
251
+ This is not in the specification, but is provided since it is such a natural extension of loading and not much code at all.
252
+
253
+ Enable tracing and start importing modules:
254
+
255
+ ``` javascript
256
+ loader .trace = true ;
257
+ loader .execute = true ; // optional, disables execution of module bodies
258
+
259
+ loader .import (' some/module' ).then (function () {
260
+ /*
261
+ Now we have:
262
+
263
+ loader.loads['some/module'] == {
264
+ name: 'some/module',
265
+ deps: ['./unnormalized', 'deps'],
266
+ depMap: {
267
+ './unnormalized': 'normalized',
268
+ 'deps': 'deps'
269
+ },
270
+ address: '/resolvedURL',
271
+ metadata: { metadata object from load },
272
+ source: 'translated source code string',
273
+ kind: 'dynamic' (instantiated) or 'declarative' (ES6 module pipeline)
274
+ }
275
+
276
+ With the dependency load records
277
+ loader.loads['normalized']
278
+ loader.loads['deps']
279
+ also set.
280
+ */
281
+ });
282
+ ```
283
+
284
+ Then start importing modules
285
+
249
286
### Extending the Loader
250
287
251
288
The loader in its default state provides only ES6 loading.
You can’t perform that action at this time.
0 commit comments