source: trip-planner-front/node_modules/loader-runner/README.md@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[6a3a178]1# loader-runner
2
3``` js
4import { runLoaders } from "loader-runner";
5
6runLoaders({
7 resource: "/abs/path/to/file.txt?query",
8 // String: Absolute path to the resource (optionally including query string)
9
10 loaders: ["/abs/path/to/loader.js?query"],
11 // String[]: Absolute paths to the loaders (optionally including query string)
12 // {loader, options}[]: Absolute paths to the loaders with options object
13
14 context: { minimize: true },
15 // Additional loader context which is used as base context
16
17 processResource: (loaderContext, resourcePath, callback) => { ... },
18 // Optional: A function to process the resource
19 // Must have signature function(context, path, function(err, buffer))
20 // By default readResource is used and the resource is added a fileDependency
21
22 readResource: fs.readFile.bind(fs)
23 // Optional: A function to read the resource
24 // Only used when 'processResource' is not provided
25 // Must have signature function(path, function(err, buffer))
26 // By default fs.readFile is used
27}, function(err, result) {
28 // err: Error?
29
30 // result.result: Buffer | String
31 // The result
32 // only available when no error occured
33
34 // result.resourceBuffer: Buffer
35 // The raw resource as Buffer (useful for SourceMaps)
36 // only available when no error occured
37
38 // result.cacheable: Bool
39 // Is the result cacheable or do it require reexecution?
40
41 // result.fileDependencies: String[]
42 // An array of paths (existing files) on which the result depends on
43
44 // result.missingDependencies: String[]
45 // An array of paths (not existing files) on which the result depends on
46
47 // result.contextDependencies: String[]
48 // An array of paths (directories) on which the result depends on
49})
50```
51
52More documentation following...
53
Note: See TracBrowser for help on using the repository browser.