@rspack/test-tools 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/case/builtin.js +1 -1
  2. package/dist/case/compiler.d.ts +5 -0
  3. package/dist/case/compiler.js +18 -0
  4. package/dist/case/config.js +1 -1
  5. package/dist/case/defaults.js +2 -2
  6. package/dist/case/diagnostic.js +2 -7
  7. package/dist/case/error.d.ts +6 -0
  8. package/dist/case/error.js +23 -0
  9. package/dist/case/hook.d.ts +1 -0
  10. package/dist/case/hook.js +37 -0
  11. package/dist/case/hot-step.js +1 -1
  12. package/dist/case/index.d.ts +5 -1
  13. package/dist/case/index.js +5 -1
  14. package/dist/case/normal.js +2 -2
  15. package/dist/case/stats-api.d.ts +6 -0
  16. package/dist/case/stats-api.js +23 -0
  17. package/dist/case/stats-output.d.ts +1 -0
  18. package/dist/case/{stats.js → stats-output.js} +3 -3
  19. package/dist/case/treeshaking.js +1 -1
  20. package/dist/helper/directory.d.ts +7 -3
  21. package/dist/helper/directory.js +60 -31
  22. package/dist/helper/index.d.ts +1 -0
  23. package/dist/helper/index.js +1 -0
  24. package/dist/helper/jestFileSnapshot.d.ts +18 -0
  25. package/dist/helper/jestFileSnapshot.js +112 -0
  26. package/dist/helper/legacy/fakeSystem.d.ts +9 -0
  27. package/dist/helper/legacy/fakeSystem.js +124 -0
  28. package/dist/helper/legacy/supportsWorker.d.ts +2 -0
  29. package/dist/helper/legacy/supportsWorker.js +17 -0
  30. package/dist/helper/legacy/warmup-webpack.d.ts +1 -0
  31. package/dist/helper/legacy/warmup-webpack.js +26 -0
  32. package/dist/helper/setupTestFramework.d.ts +1 -0
  33. package/dist/helper/setupTestFramework.js +121 -0
  34. package/dist/helper/util/checkSourceMap.d.ts +1 -0
  35. package/dist/helper/util/checkSourceMap.js +80 -0
  36. package/dist/helper/util/currentWatchStep.d.ts +1 -0
  37. package/dist/helper/util/currentWatchStep.js +2 -0
  38. package/dist/helper/util/expectWarningFactory.d.ts +2 -0
  39. package/dist/helper/util/expectWarningFactory.js +21 -0
  40. package/dist/helper/util/filterUtil.d.ts +8 -0
  41. package/dist/helper/util/filterUtil.js +50 -0
  42. package/dist/helper/util/identifier.d.ts +76 -0
  43. package/dist/helper/util/identifier.js +345 -0
  44. package/dist/helper/util/replaceMitteDiagnostic.d.ts +2 -0
  45. package/dist/helper/util/replaceMitteDiagnostic.js +17 -0
  46. package/dist/helper/win.d.ts +2 -0
  47. package/dist/helper/win.js +15 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.js +1 -0
  50. package/dist/plugin/webpack-module-placeholder-plugin.js +2 -3
  51. package/dist/processor/defaults.js +11 -23
  52. package/dist/processor/diagnostic.d.ts +0 -3
  53. package/dist/processor/diagnostic.js +17 -20
  54. package/dist/processor/error.d.ts +23 -0
  55. package/dist/processor/error.js +142 -0
  56. package/dist/processor/hook.d.ts +41 -0
  57. package/dist/processor/hook.js +189 -0
  58. package/dist/processor/hot-step.d.ts +2 -1
  59. package/dist/processor/hot-step.js +66 -14
  60. package/dist/processor/index.d.ts +2 -0
  61. package/dist/processor/index.js +2 -0
  62. package/dist/processor/normal.d.ts +0 -2
  63. package/dist/processor/normal.js +1 -10
  64. package/dist/processor/simple.js +2 -6
  65. package/dist/processor/snapshot.js +6 -6
  66. package/dist/processor/stats-api.d.ts +0 -2
  67. package/dist/processor/stats-api.js +1 -13
  68. package/dist/processor/stats.js +2 -1
  69. package/dist/processor/watch.js +4 -4
  70. package/dist/runner/hot-step.js +3 -2
  71. package/dist/runner/runner/basic.d.ts +1 -0
  72. package/dist/runner/runner/basic.js +3 -0
  73. package/dist/runner/runner/web/jsdom.d.ts +1 -0
  74. package/dist/runner/runner/web/jsdom.js +11 -5
  75. package/dist/runner/runner/web.d.ts +1 -0
  76. package/dist/runner/runner/web.js +3 -0
  77. package/dist/runner/type.d.ts +13 -0
  78. package/dist/test/simple.d.ts +5 -0
  79. package/dist/test/simple.js +36 -0
  80. package/dist/type.d.ts +1 -0
  81. package/package.json +11 -6
  82. package/dist/case/stats.d.ts +0 -1
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ const System = {
4
+ register: (name, deps, fn) => {
5
+ if (!System.registry) {
6
+ throw new Error("System is no initialized");
7
+ }
8
+ if (typeof name !== "string") {
9
+ fn = deps;
10
+ deps = name;
11
+ name = System._nextName;
12
+ }
13
+ if (!Array.isArray(deps)) {
14
+ fn = deps;
15
+ deps = [];
16
+ }
17
+ const dynamicExport = result => {
18
+ if (System.registry[name] !== entry) {
19
+ throw new Error(`Module ${name} calls dynamicExport too late`);
20
+ }
21
+ entry.exports = result;
22
+ for (const mod of Object.keys(System.registry)) {
23
+ const m = System.registry[mod];
24
+ if (!m.deps)
25
+ continue;
26
+ for (let i = 0; i < m.deps.length; i++) {
27
+ const dep = m.deps[i];
28
+ if (dep !== name)
29
+ continue;
30
+ const setters = m.mod.setters[i];
31
+ setters(result);
32
+ }
33
+ }
34
+ };
35
+ const systemContext = {
36
+ meta: {
37
+ url: `/${name}.js`
38
+ },
39
+ import() {
40
+ return Promise.resolve();
41
+ }
42
+ };
43
+ if (name in System.registry) {
44
+ throw new Error(`Module ${name} is already registered`);
45
+ }
46
+ const mod = fn(dynamicExport, systemContext);
47
+ if (deps.length > 0) {
48
+ if (!Array.isArray(mod.setters)) {
49
+ throw new Error(`Module ${name} must have setters, because it has dependencies`);
50
+ }
51
+ if (mod.setters.length !== deps.length) {
52
+ throw new Error(`Module ${name} has incorrect number of setters for the dependencies`);
53
+ }
54
+ }
55
+ const entry = {
56
+ name,
57
+ deps,
58
+ fn,
59
+ mod,
60
+ executed: false,
61
+ exports: undefined
62
+ };
63
+ System.registry[name] = entry;
64
+ },
65
+ set: (name, exports) => {
66
+ System.registry[name] = {
67
+ name,
68
+ executed: true,
69
+ exports
70
+ };
71
+ },
72
+ registry: undefined,
73
+ _require: undefined,
74
+ _nextName: "(anonym)",
75
+ setRequire: req => {
76
+ System._require = req;
77
+ },
78
+ init: modules => {
79
+ System.registry = {};
80
+ if (modules) {
81
+ for (const name of Object.keys(modules)) {
82
+ System.registry[name] = {
83
+ executed: true,
84
+ exports: modules[name]
85
+ };
86
+ }
87
+ }
88
+ },
89
+ execute: name => {
90
+ const m = System.registry[name];
91
+ if (!m)
92
+ throw new Error(`Module ${name} not registered`);
93
+ if (m.executed)
94
+ throw new Error(`Module ${name} was already executed`);
95
+ return System.ensureExecuted(name);
96
+ },
97
+ ensureExecuted: name => {
98
+ let m = System.registry[name];
99
+ if (!m && System._require) {
100
+ const oldName = System._nextName;
101
+ System._nextName = name;
102
+ System._require(name);
103
+ System._nextName = oldName;
104
+ m = System.registry[name];
105
+ }
106
+ if (!m) {
107
+ throw new Error(`Module ${name} not registered`);
108
+ }
109
+ if (!m.executed) {
110
+ m.executed = true;
111
+ for (let i = 0; i < m.deps.length; i++) {
112
+ const dep = m.deps[i];
113
+ const setters = m.mod.setters[i];
114
+ System.ensureExecuted(dep);
115
+ const { exports } = System.registry[dep];
116
+ if (exports !== undefined)
117
+ setters(exports);
118
+ }
119
+ m.mod.execute();
120
+ }
121
+ return m.exports;
122
+ }
123
+ };
124
+ module.exports = System;
@@ -0,0 +1,2 @@
1
+ declare function _exports(): boolean;
2
+ export = _exports;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ const nodeVersion = process.versions.node.split(".").map(Number);
4
+ module.exports = function supportsWorker() {
5
+ // Verify that in the current node version new Worker() accepts URL as the first parameter:
6
+ // https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options
7
+ if (nodeVersion[0] >= 14) {
8
+ return true;
9
+ }
10
+ else if (nodeVersion[0] === 13 && nodeVersion[1] >= 12) {
11
+ return true;
12
+ }
13
+ else if (nodeVersion[0] === 12 && nodeVersion[1] >= 17) {
14
+ return true;
15
+ }
16
+ return false;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ describe("warmup", () => {
4
+ it("should warmup webpack", done => {
5
+ let webpack = require("@rspack/core");
6
+ let END = new Error("end warmup");
7
+ webpack({
8
+ entry: "data:text/javascript,import 'data:text/javascript,'",
9
+ plugins: [
10
+ c => c.hooks.emit.tap("Warmup", () => {
11
+ throw END;
12
+ })
13
+ ]
14
+ }, err => {
15
+ webpack = undefined;
16
+ try {
17
+ // CHANGE: rspack will format error into diagnostic.
18
+ expect(err.message).toContain("end warmup");
19
+ done();
20
+ }
21
+ catch (e) {
22
+ done(e);
23
+ }
24
+ });
25
+ }, 300000);
26
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ const { toMatchFileSnapshot } = require("./jestFileSnapshot");
4
+ expect.extend({
5
+ // CHANGE: new test matcher for `rspack-test-tools`
6
+ toMatchFileSnapshot,
7
+ toBeTypeOf(received, expected) {
8
+ const objType = typeof received;
9
+ const pass = objType === expected;
10
+ const message = pass
11
+ ? () => this.utils.matcherHint(".not.toBeTypeOf") +
12
+ "\n\n" +
13
+ "Expected value to not be (using typeof):\n" +
14
+ ` ${this.utils.printExpected(expected)}\n` +
15
+ "Received:\n" +
16
+ ` ${this.utils.printReceived(objType)}`
17
+ : () => this.utils.matcherHint(".toBeTypeOf") +
18
+ "\n\n" +
19
+ "Expected value to be (using typeof):\n" +
20
+ ` ${this.utils.printExpected(expected)}\n` +
21
+ "Received:\n" +
22
+ ` ${this.utils.printReceived(objType)}`;
23
+ return { message, pass };
24
+ },
25
+ toEndWith(received, expected) {
26
+ const pass = typeof received === "string" && received.endsWith(expected);
27
+ const message = pass
28
+ ? () => this.utils.matcherHint(".not.toEndWith") +
29
+ "\n\n" +
30
+ "Expected value to not end with:\n" +
31
+ ` ${this.utils.printExpected(expected)}\n` +
32
+ "Received:\n" +
33
+ ` ${this.utils.printReceived(received)}`
34
+ : () => this.utils.matcherHint(".toEndWith") +
35
+ "\n\n" +
36
+ "Expected value to end with:\n" +
37
+ ` ${this.utils.printExpected(expected)}\n` +
38
+ "Received:\n" +
39
+ ` ${this.utils.printReceived(received)}`;
40
+ return { message, pass };
41
+ }
42
+ });
43
+ if (process.env.ALTERNATIVE_SORT) {
44
+ const oldSort = Array.prototype.sort;
45
+ Array.prototype.sort = function (cmp) {
46
+ oldSort.call(this, cmp);
47
+ if (cmp) {
48
+ for (let i = 1; i < this.length; i++) {
49
+ if (cmp(this[i - 1], this[i]) === 0) {
50
+ let j = i + 1;
51
+ for (; j < this.length; j++) {
52
+ if (cmp(this[j - 1], this[j]) !== 0) {
53
+ break;
54
+ }
55
+ }
56
+ for (let x = i - 1, y = j - 1; x < y; x++, y--) {
57
+ const temp = this[x];
58
+ this[x] = this[y];
59
+ this[y] = temp;
60
+ }
61
+ i = j;
62
+ }
63
+ }
64
+ }
65
+ return this;
66
+ };
67
+ }
68
+ // Setup debugging info for tests
69
+ if (process.env.DEBUG_INFO) {
70
+ const addDebugInfo = it => {
71
+ return (name, fn, timeout) => {
72
+ if (fn.length === 0) {
73
+ it(name, () => {
74
+ process.stdout.write(`START1 ${name}\n`);
75
+ try {
76
+ const promise = fn();
77
+ if (promise && promise.then) {
78
+ return promise.then(r => {
79
+ process.stdout.write(`DONE OK ${name}\n`);
80
+ return r;
81
+ }, e => {
82
+ process.stdout.write(`DONE FAIL ${name}\n`);
83
+ throw e;
84
+ });
85
+ }
86
+ else {
87
+ process.stdout.write(`DONE OK ${name}\n`);
88
+ }
89
+ }
90
+ catch (e) {
91
+ process.stdout.write(`DONE FAIL ${name}\n`);
92
+ throw e;
93
+ }
94
+ }, timeout);
95
+ }
96
+ else {
97
+ it(name, done => {
98
+ process.stdout.write(`START2 ${name}\n`);
99
+ return fn(err => {
100
+ if (err) {
101
+ process.stdout.write(`DONE FAIL ${name}\n`);
102
+ }
103
+ else {
104
+ process.stdout.write(`DONE OK ${name}\n`);
105
+ }
106
+ return done(err);
107
+ });
108
+ }, timeout);
109
+ }
110
+ };
111
+ };
112
+ // eslint-disable-next-line no-global-assign
113
+ it = addDebugInfo(it);
114
+ }
115
+ // cspell:word wabt
116
+ // Workaround for a memory leak in wabt
117
+ // It leaks an Error object on construction
118
+ // so it leaks the whole stack trace
119
+ require("wast-loader");
120
+ process.removeAllListeners("uncaughtException");
121
+ process.removeAllListeners("unhandledRejection");
@@ -0,0 +1 @@
1
+ export default function checkSourceMap(out: any, outCodeMap: any, toSearch: any): Promise<boolean>;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // @ts-nocheck
4
+ // Check the mapping of various key locations back to the original source
5
+ async function checkSourceMap(out, outCodeMap, toSearch) {
6
+ let failed = false;
7
+ const recordCheck = (success, message) => {
8
+ if (!success) {
9
+ failed = true;
10
+ console.error(`❌ ${message}`);
11
+ }
12
+ };
13
+ const sourceMap = require("source-map");
14
+ const path = require("path");
15
+ const sources = JSON.parse(outCodeMap).sources;
16
+ for (let source of sources) {
17
+ if (sources.filter(s => s === source).length > 1) {
18
+ throw new Error(`Duplicate source ${JSON.stringify(source)} found in source map`);
19
+ }
20
+ }
21
+ const map = await new sourceMap.SourceMapConsumer(outCodeMap);
22
+ for (const id in toSearch) {
23
+ const outIndex = out.indexOf(id);
24
+ if (outIndex < 0)
25
+ throw new Error(`Failed to find "${id}" in output ${out}`);
26
+ const outLines = out.slice(0, outIndex).split("\n");
27
+ const outLine = outLines.length;
28
+ const outLastLine = outLines[outLines.length - 1];
29
+ let outColumn = outLastLine.length;
30
+ const { source, line, column } = map.originalPositionFor({
31
+ line: outLine,
32
+ column: outColumn
33
+ });
34
+ const inSource = toSearch[id];
35
+ recordCheck(source === inSource, `expected source: ${inSource}, observed source: ${source}@${line}:${column}, {out_source}@${outLine}:${outColumn}.`);
36
+ const inCode = map.sourceContentFor(source);
37
+ let inIndex = inCode.indexOf(id);
38
+ if (inIndex < 0)
39
+ inIndex = inCode.indexOf(`'${id}'`);
40
+ if (inIndex < 0)
41
+ throw new Error(`Failed to find "${id}" in input ${inCode}`);
42
+ const inLines = inCode.slice(0, inIndex).split("\n");
43
+ const inLine = inLines.length;
44
+ const inLastLine = inLines[inLines.length - 1];
45
+ let inColumn = inLastLine.length;
46
+ if (path.extname(source) === "css") {
47
+ const outMatch = /\s*content:\s*$/.exec(outLastLine);
48
+ const inMatch = /\bcontent:\s*$/.exec(inLastLine);
49
+ if (outMatch)
50
+ outColumn -= outMatch[0].length;
51
+ if (inMatch)
52
+ inColumn -= inMatch[0].length;
53
+ }
54
+ const expected = JSON.stringify({ source, line: inLine, column: inColumn });
55
+ const observed = JSON.stringify({ source, line, column });
56
+ recordCheck(expected === observed, `expected original position: ${expected}, observed original position: ${observed}, out: ${outLine + "," + outColumn + "," + outIndex + ":" + id}`);
57
+ // Also check the reverse mapping
58
+ const positions = map.allGeneratedPositionsFor({
59
+ source,
60
+ line: inLine,
61
+ column: inColumn
62
+ });
63
+ recordCheck(positions.length > 0, `expected generated positions: 1, observed generated positions: ${positions.length}`);
64
+ let found = false;
65
+ for (const { line, column } of positions) {
66
+ if (line === outLine && column === outColumn) {
67
+ found = true;
68
+ break;
69
+ }
70
+ }
71
+ const expectedPosition = JSON.stringify({
72
+ line: outLine,
73
+ column: outColumn
74
+ });
75
+ const observedPositions = JSON.stringify(positions);
76
+ recordCheck(found, `expected generated position: ${expectedPosition}, observed generated positions: ${observedPositions}`);
77
+ }
78
+ return !failed;
79
+ }
80
+ exports.default = checkSourceMap;
@@ -0,0 +1 @@
1
+ export { undefined as step };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ exports.step = undefined;
@@ -0,0 +1,2 @@
1
+ declare function _exports(): (...regexp: any[]) => void;
2
+ export = _exports;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ module.exports = () => {
4
+ let warnings = [];
5
+ let oldWarn;
6
+ beforeEach(done => {
7
+ oldWarn = console.warn;
8
+ console.warn = m => warnings.push(m);
9
+ done();
10
+ });
11
+ afterEach(done => {
12
+ expectWarning();
13
+ console.warn = oldWarn;
14
+ done();
15
+ });
16
+ const expectWarning = (...regexp) => {
17
+ expect(warnings).toEqual(regexp.map(r => expect.stringMatching(r)));
18
+ warnings.length = 0;
19
+ };
20
+ return expectWarning;
21
+ };
@@ -0,0 +1,8 @@
1
+ export namespace FilteredStatus {
2
+ const TODO: string;
3
+ const PARTIAL_PASS: string;
4
+ const FAILED: string;
5
+ const NO_PLAN: string;
6
+ }
7
+ export function decodeFilteredTest(encoded: any): any;
8
+ export function normalizeFilteredTestName(flag: any, testName: any): string;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ const FilteredStatus = {
4
+ TODO: "TODO",
5
+ PARTIAL_PASS: "PARTIAL_PASS",
6
+ FAILED: "FAILED",
7
+ NO_PLAN: "NO_PLAN"
8
+ };
9
+ function validateFilteredStatus(status) {
10
+ return Object.values(FilteredStatus).includes(status);
11
+ }
12
+ function normalizeFilterFlag(flag, testName) {
13
+ if (flag === false) {
14
+ return { status: FilteredStatus.TODO, reason: "TODO" };
15
+ }
16
+ if (flag === -1) {
17
+ return { status: FilteredStatus.NO_PLAN, reason: "No plan" };
18
+ }
19
+ if (typeof flag === "string") {
20
+ return { status: FilteredStatus.FAILED, reason: flag };
21
+ }
22
+ if (Array.isArray(flag)) {
23
+ const [status, reason = "empty"] = flag;
24
+ if (validateFilteredStatus(status)) {
25
+ return { status, reason };
26
+ }
27
+ }
28
+ throw new Error(`Unvalidate filter flag "${flag}" for "${testName}"`);
29
+ }
30
+ function encodeFilteredTest(status, reason) {
31
+ return `{{ status = ${status}, reason = ${reason} }}`;
32
+ }
33
+ function decodeFilteredTest(encoded) {
34
+ const regex = /(.*) {{ status = (.*), reason = (.*) }}$/;
35
+ const result = encoded.match(regex);
36
+ if (result === null) {
37
+ return result;
38
+ }
39
+ const [, fullName, status, reason] = result;
40
+ return { fullName, status, reason };
41
+ }
42
+ function normalizeFilteredTestName(flag, testName) {
43
+ const { status, reason } = normalizeFilterFlag(flag, testName);
44
+ return encodeFilteredTest(status, reason);
45
+ }
46
+ module.exports = {
47
+ FilteredStatus,
48
+ decodeFilteredTest,
49
+ normalizeFilteredTestName
50
+ };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @param {string} context context used to create relative path
3
+ * @param {string} identifier identifier used to create relative path
4
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
5
+ * @returns {string} the returned relative path
6
+ */
7
+ export function makePathsRelative(context: string, identifier: string, associatedObjectForCache?: Object | undefined): string;
8
+ export namespace makePathsRelative {
9
+ /**
10
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
11
+ * @returns {function(string, string): string} cached function
12
+ */
13
+ function bindCache(associatedObjectForCache?: Object | undefined): (arg0: string, arg1: string) => string;
14
+ /**
15
+ * @param {string} context context used to create relative path
16
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
17
+ * @returns {function(string): string} cached function
18
+ */
19
+ function bindContextCache(context: string, associatedObjectForCache?: Object | undefined): (arg0: string) => string;
20
+ }
21
+ /**
22
+ * @param {string} context context used to create relative path
23
+ * @param {string} identifier identifier used to create relative path
24
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
25
+ * @returns {string} the returned relative path
26
+ */
27
+ export function makePathsAbsolute(context: string, identifier: string, associatedObjectForCache?: Object | undefined): string;
28
+ export namespace makePathsAbsolute { }
29
+ /**
30
+ * @param {string} str the path with query and fragment
31
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
32
+ * @returns {ParsedResource} parsed parts
33
+ */
34
+ export function parseResource(str: string, associatedObjectForCache?: Object | undefined): ParsedResource;
35
+ export namespace parseResource {
36
+ function bindCache(associatedObjectForCache: any): (str: any) => any;
37
+ }
38
+ /**
39
+ * @param {string} str the path with query and fragment
40
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
41
+ * @returns {ParsedResource} parsed parts
42
+ */
43
+ export function parseResourceWithoutFragment(str: string, associatedObjectForCache?: Object | undefined): ParsedResource;
44
+ export namespace parseResourceWithoutFragment { }
45
+ export function getUndoPath(filename: string, outputPath: string, enforceRelative: boolean): string;
46
+ export type MakeRelativePathsCache = {
47
+ relativePaths?: Map<string, Map<string, string>> | undefined;
48
+ };
49
+ export type ParsedResource = {
50
+ resource: string;
51
+ path: string;
52
+ query: string;
53
+ fragment: string;
54
+ };
55
+ export type ParsedResourceWithoutFragment = {
56
+ resource: string;
57
+ path: string;
58
+ query: string;
59
+ };
60
+ /**
61
+ * @param {string} context context used to create relative path
62
+ * @param {string} identifier identifier used to create relative path
63
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
64
+ * @returns {string} the returned relative path
65
+ */
66
+ export function contextify(context: string, identifier: string, associatedObjectForCache?: Object | undefined): string;
67
+ export namespace contextify { }
68
+ /**
69
+ * @param {string} context context used to create relative path
70
+ * @param {string} identifier identifier used to create relative path
71
+ * @param {Object=} associatedObjectForCache an object to which the cache will be attached
72
+ * @returns {string} the returned relative path
73
+ */
74
+ export function absolutify(context: string, identifier: string, associatedObjectForCache?: Object | undefined): string;
75
+ export namespace absolutify { }
76
+ import path = require("path");