@depup/angular-devkit__core 21.2.2-depup.0
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.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/index.d.ts +8 -0
- package/index.js +25 -0
- package/index.js.map +1 -0
- package/node/cli-logger.d.ts +15 -0
- package/node/cli-logger.js +58 -0
- package/node/cli-logger.js.map +1 -0
- package/node/host.d.ts +43 -0
- package/node/host.js +211 -0
- package/node/host.js.map +1 -0
- package/node/index.d.ts +9 -0
- package/node/index.js +26 -0
- package/node/index.js.map +1 -0
- package/node/testing/index.d.ts +20 -0
- package/node/testing/index.js +90 -0
- package/node/testing/index.js.map +1 -0
- package/package.json +76 -0
- package/src/exception.d.ts +25 -0
- package/src/exception.js +48 -0
- package/src/exception.js.map +1 -0
- package/src/index.d.ts +15 -0
- package/src/index.js +57 -0
- package/src/index.js.map +1 -0
- package/src/json/index.d.ts +10 -0
- package/src/json/index.js +50 -0
- package/src/json/index.js.map +1 -0
- package/src/json/schema/index.d.ts +15 -0
- package/src/json/schema/index.js +55 -0
- package/src/json/schema/index.js.map +1 -0
- package/src/json/schema/interface.d.ts +84 -0
- package/src/json/schema/interface.js +10 -0
- package/src/json/schema/interface.js.map +1 -0
- package/src/json/schema/pointer.d.ts +11 -0
- package/src/json/schema/pointer.js +39 -0
- package/src/json/schema/pointer.js.map +1 -0
- package/src/json/schema/registry.d.ts +79 -0
- package/src/json/schema/registry.js +565 -0
- package/src/json/schema/registry.js.map +1 -0
- package/src/json/schema/schema.d.ts +22 -0
- package/src/json/schema/schema.js +52 -0
- package/src/json/schema/schema.js.map +1 -0
- package/src/json/schema/transforms.d.ts +12 -0
- package/src/json/schema/transforms.js +101 -0
- package/src/json/schema/transforms.js.map +1 -0
- package/src/json/schema/utility.d.ts +9 -0
- package/src/json/schema/utility.js +88 -0
- package/src/json/schema/utility.js.map +1 -0
- package/src/json/schema/visitor.d.ts +34 -0
- package/src/json/schema/visitor.js +147 -0
- package/src/json/schema/visitor.js.map +1 -0
- package/src/json/utils.d.ts +15 -0
- package/src/json/utils.js +18 -0
- package/src/json/utils.js.map +1 -0
- package/src/logger/indent.d.ts +11 -0
- package/src/logger/indent.js +41 -0
- package/src/logger/indent.js.map +1 -0
- package/src/logger/index.d.ts +12 -0
- package/src/logger/index.js +29 -0
- package/src/logger/index.js.map +1 -0
- package/src/logger/level.d.ts +28 -0
- package/src/logger/level.js +51 -0
- package/src/logger/level.js.map +1 -0
- package/src/logger/logger.d.ts +55 -0
- package/src/logger/logger.js +123 -0
- package/src/logger/logger.js.map +1 -0
- package/src/logger/null-logger.d.ts +12 -0
- package/src/logger/null-logger.js +31 -0
- package/src/logger/null-logger.js.map +1 -0
- package/src/logger/transform-logger.d.ts +12 -0
- package/src/logger/transform-logger.js +19 -0
- package/src/logger/transform-logger.js.map +1 -0
- package/src/utils/index.d.ts +15 -0
- package/src/utils/index.js +56 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/lang.d.ts +11 -0
- package/src/utils/lang.js +21 -0
- package/src/utils/lang.js.map +1 -0
- package/src/utils/literals.d.ts +15 -0
- package/src/utils/literals.js +59 -0
- package/src/utils/literals.js.map +1 -0
- package/src/utils/object.d.ts +8 -0
- package/src/utils/object.js +37 -0
- package/src/utils/object.js.map +1 -0
- package/src/utils/partially-ordered-set.d.ts +38 -0
- package/src/utils/partially-ordered-set.js +145 -0
- package/src/utils/partially-ordered-set.js.map +1 -0
- package/src/utils/priority-queue.d.ts +19 -0
- package/src/utils/priority-queue.js +50 -0
- package/src/utils/priority-queue.js.map +1 -0
- package/src/utils/strings.d.ts +112 -0
- package/src/utils/strings.js +179 -0
- package/src/utils/strings.js.map +1 -0
- package/src/utils/template.d.ts +89 -0
- package/src/utils/template.js +260 -0
- package/src/utils/template.js.map +1 -0
- package/src/virtual-fs/host/alias.d.ts +60 -0
- package/src/virtual-fs/host/alias.js +84 -0
- package/src/virtual-fs/host/alias.js.map +1 -0
- package/src/virtual-fs/host/buffer.d.ts +10 -0
- package/src/virtual-fs/host/buffer.js +22 -0
- package/src/virtual-fs/host/buffer.js.map +1 -0
- package/src/virtual-fs/host/create.d.ts +21 -0
- package/src/virtual-fs/host/create.js +55 -0
- package/src/virtual-fs/host/create.js.map +1 -0
- package/src/virtual-fs/host/empty.d.ts +19 -0
- package/src/virtual-fs/host/empty.js +38 -0
- package/src/virtual-fs/host/empty.js.map +1 -0
- package/src/virtual-fs/host/index.d.ts +21 -0
- package/src/virtual-fs/host/index.js +61 -0
- package/src/virtual-fs/host/index.js.map +1 -0
- package/src/virtual-fs/host/interface.d.ts +53 -0
- package/src/virtual-fs/host/interface.js +18 -0
- package/src/virtual-fs/host/interface.js.map +1 -0
- package/src/virtual-fs/host/memory.d.ts +49 -0
- package/src/virtual-fs/host/memory.js +332 -0
- package/src/virtual-fs/host/memory.js.map +1 -0
- package/src/virtual-fs/host/pattern.d.ts +17 -0
- package/src/virtual-fs/host/pattern.js +35 -0
- package/src/virtual-fs/host/pattern.js.map +1 -0
- package/src/virtual-fs/host/record.d.ts +92 -0
- package/src/virtual-fs/host/record.js +315 -0
- package/src/virtual-fs/host/record.js.map +1 -0
- package/src/virtual-fs/host/resolver.d.ts +30 -0
- package/src/virtual-fs/host/resolver.js +57 -0
- package/src/virtual-fs/host/resolver.js.map +1 -0
- package/src/virtual-fs/host/safe.d.ts +25 -0
- package/src/virtual-fs/host/safe.js +46 -0
- package/src/virtual-fs/host/safe.js.map +1 -0
- package/src/virtual-fs/host/scoped.d.ts +15 -0
- package/src/virtual-fs/host/scoped.js +24 -0
- package/src/virtual-fs/host/scoped.js.map +1 -0
- package/src/virtual-fs/host/sync.d.ts +34 -0
- package/src/virtual-fs/host/sync.js +93 -0
- package/src/virtual-fs/host/sync.js.map +1 -0
- package/src/virtual-fs/host/test.d.ts +48 -0
- package/src/virtual-fs/host/test.js +119 -0
- package/src/virtual-fs/host/test.js.map +1 -0
- package/src/virtual-fs/index.d.ts +10 -0
- package/src/virtual-fs/index.js +50 -0
- package/src/virtual-fs/index.js.map +1 -0
- package/src/virtual-fs/path.d.ts +111 -0
- package/src/virtual-fs/path.js +286 -0
- package/src/virtual-fs/path.js.map +1 -0
- package/src/workspace/core.d.ts +61 -0
- package/src/workspace/core.js +133 -0
- package/src/workspace/core.js.map +1 -0
- package/src/workspace/definitions.d.ts +63 -0
- package/src/workspace/definitions.js +169 -0
- package/src/workspace/definitions.js.map +1 -0
- package/src/workspace/host.d.ts +15 -0
- package/src/workspace/host.js +43 -0
- package/src/workspace/host.js.map +1 -0
- package/src/workspace/index.d.ts +10 -0
- package/src/workspace/index.js +32 -0
- package/src/workspace/index.js.map +1 -0
- package/src/workspace/json/metadata.d.ts +40 -0
- package/src/workspace/json/metadata.js +60 -0
- package/src/workspace/json/metadata.js.map +1 -0
- package/src/workspace/json/reader.d.ts +14 -0
- package/src/workspace/json/reader.js +231 -0
- package/src/workspace/json/reader.js.map +1 -0
- package/src/workspace/json/utilities.d.ts +14 -0
- package/src/workspace/json/utilities.js +113 -0
- package/src/workspace/json/utilities.js.map +1 -0
- package/src/workspace/json/writer.d.ts +12 -0
- package/src/workspace/json/writer.js +145 -0
- package/src/workspace/json/writer.js.map +1 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.templateParser = templateParser;
|
|
11
|
+
exports.template = template;
|
|
12
|
+
const source_map_1 = require("source-map");
|
|
13
|
+
// Matches <%= expr %>. This does not support structural JavaScript (for/if/...).
|
|
14
|
+
const kInterpolateRe = /<%=([\s\S]+?)%>/g;
|
|
15
|
+
// Matches <%# text %>. It's a comment and will be entirely ignored.
|
|
16
|
+
const kCommentRe = /<%#([\s\S]+?)%>/g;
|
|
17
|
+
// Used to match template delimiters.
|
|
18
|
+
// <%- expr %>: HTML escape the value.
|
|
19
|
+
// <% ... %>: Structural template code.
|
|
20
|
+
const kEscapeRe = /<%-([\s\S]+?)%>/g;
|
|
21
|
+
const kEvaluateRe = /<%([\s\S]+?)%>/g;
|
|
22
|
+
/** Used to map characters to HTML entities. */
|
|
23
|
+
const kHtmlEscapes = {
|
|
24
|
+
'&': '&',
|
|
25
|
+
'<': '<',
|
|
26
|
+
'>': '>',
|
|
27
|
+
'"': '"',
|
|
28
|
+
"'": ''',
|
|
29
|
+
'`': '`',
|
|
30
|
+
};
|
|
31
|
+
// Used to match HTML entities and HTML characters.
|
|
32
|
+
const reUnescapedHtml = new RegExp(`[${Object.keys(kHtmlEscapes).join('')}]`, 'g');
|
|
33
|
+
function _positionFor(content, offset) {
|
|
34
|
+
let line = 1;
|
|
35
|
+
let column = 0;
|
|
36
|
+
for (let i = 0; i < offset - 1; i++) {
|
|
37
|
+
if (content[i] == '\n') {
|
|
38
|
+
line++;
|
|
39
|
+
column = 0;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
column++;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
line,
|
|
47
|
+
column,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Given a source text (and a fileName), returns a TemplateAst.
|
|
52
|
+
*/
|
|
53
|
+
function templateParser(sourceText, fileName) {
|
|
54
|
+
const children = [];
|
|
55
|
+
// Compile the regexp to match each delimiter.
|
|
56
|
+
const reExpressions = [kEscapeRe, kCommentRe, kInterpolateRe, kEvaluateRe];
|
|
57
|
+
const reDelimiters = RegExp(reExpressions.map((x) => x.source).join('|') + '|$', 'g');
|
|
58
|
+
const parsed = sourceText.split(reDelimiters);
|
|
59
|
+
let offset = 0;
|
|
60
|
+
// Optimization that uses the fact that the end of a node is always the beginning of the next
|
|
61
|
+
// node, so we keep the positioning of the nodes in memory.
|
|
62
|
+
let start = _positionFor(sourceText, offset);
|
|
63
|
+
let end;
|
|
64
|
+
const increment = reExpressions.length + 1;
|
|
65
|
+
for (let i = 0; i < parsed.length; i += increment) {
|
|
66
|
+
const [content, escape, comment, interpolate, evaluate] = parsed.slice(i, i + increment);
|
|
67
|
+
if (content) {
|
|
68
|
+
end = _positionFor(sourceText, offset + content.length);
|
|
69
|
+
offset += content.length;
|
|
70
|
+
children.push({ kind: 'content', content, start, end });
|
|
71
|
+
start = end;
|
|
72
|
+
}
|
|
73
|
+
if (escape) {
|
|
74
|
+
end = _positionFor(sourceText, offset + escape.length + 5);
|
|
75
|
+
offset += escape.length + 5;
|
|
76
|
+
children.push({ kind: 'escape', expression: escape, start, end });
|
|
77
|
+
start = end;
|
|
78
|
+
}
|
|
79
|
+
if (comment) {
|
|
80
|
+
end = _positionFor(sourceText, offset + comment.length + 5);
|
|
81
|
+
offset += comment.length + 5;
|
|
82
|
+
children.push({ kind: 'comment', text: comment, start, end });
|
|
83
|
+
start = end;
|
|
84
|
+
}
|
|
85
|
+
if (interpolate) {
|
|
86
|
+
end = _positionFor(sourceText, offset + interpolate.length + 5);
|
|
87
|
+
offset += interpolate.length + 5;
|
|
88
|
+
children.push({
|
|
89
|
+
kind: 'interpolate',
|
|
90
|
+
expression: interpolate,
|
|
91
|
+
start,
|
|
92
|
+
end,
|
|
93
|
+
});
|
|
94
|
+
start = end;
|
|
95
|
+
}
|
|
96
|
+
if (evaluate) {
|
|
97
|
+
end = _positionFor(sourceText, offset + evaluate.length + 5);
|
|
98
|
+
offset += evaluate.length + 5;
|
|
99
|
+
children.push({ kind: 'evaluate', expression: evaluate, start, end });
|
|
100
|
+
start = end;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
fileName,
|
|
105
|
+
content: sourceText,
|
|
106
|
+
children,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Fastest implementation of the templating algorithm. It only add strings and does not bother
|
|
111
|
+
* with source maps.
|
|
112
|
+
*/
|
|
113
|
+
function templateFast(ast, options) {
|
|
114
|
+
const module = options && options.module ? 'module.exports.default =' : '';
|
|
115
|
+
const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, "\\\\\\'");
|
|
116
|
+
return `
|
|
117
|
+
return ${module} function(obj) {
|
|
118
|
+
obj || (obj = {});
|
|
119
|
+
let __t;
|
|
120
|
+
let __p = '';
|
|
121
|
+
const __escapes = ${JSON.stringify(kHtmlEscapes)};
|
|
122
|
+
const __escapesre = new RegExp('${reHtmlEscape}', 'g');
|
|
123
|
+
|
|
124
|
+
const __e = function(s) {
|
|
125
|
+
return s ? s.replace(__escapesre, function(key) { return __escapes[key]; }) : '';
|
|
126
|
+
};
|
|
127
|
+
with (obj) {
|
|
128
|
+
${ast.children
|
|
129
|
+
.map((node) => {
|
|
130
|
+
switch (node.kind) {
|
|
131
|
+
case 'content':
|
|
132
|
+
return `__p += ${JSON.stringify(node.content)};`;
|
|
133
|
+
case 'interpolate':
|
|
134
|
+
return `__p += ((__t = (${node.expression})) == null) ? '' : __t;`;
|
|
135
|
+
case 'escape':
|
|
136
|
+
return `__p += __e(${node.expression});`;
|
|
137
|
+
case 'evaluate':
|
|
138
|
+
return node.expression;
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
.join('\n')}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return __p;
|
|
145
|
+
};
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Templating algorithm with source map support. The map is outputted as //# sourceMapUrl=...
|
|
150
|
+
*/
|
|
151
|
+
function templateWithSourceMap(ast, options) {
|
|
152
|
+
const sourceUrl = ast.fileName;
|
|
153
|
+
const module = options && options.module ? 'module.exports.default =' : '';
|
|
154
|
+
const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, "\\\\\\'");
|
|
155
|
+
const preamble = new source_map_1.SourceNode(1, 0, sourceUrl, '').add(new source_map_1.SourceNode(1, 0, sourceUrl, [
|
|
156
|
+
`return ${module} function(obj) {\n`,
|
|
157
|
+
' obj || (obj = {});\n',
|
|
158
|
+
' let __t;\n',
|
|
159
|
+
' let __p = "";\n',
|
|
160
|
+
` const __escapes = ${JSON.stringify(kHtmlEscapes)};\n`,
|
|
161
|
+
` const __escapesre = new RegExp('${reHtmlEscape}', 'g');\n`,
|
|
162
|
+
`\n`,
|
|
163
|
+
` const __e = function(s) { `,
|
|
164
|
+
` return s ? s.replace(__escapesre, function(key) { return __escapes[key]; }) : '';`,
|
|
165
|
+
` };\n`,
|
|
166
|
+
` with (obj) {\n`,
|
|
167
|
+
]));
|
|
168
|
+
const end = ast.children.at(-1)?.end ?? { line: 0, column: 0 };
|
|
169
|
+
const nodes = ast.children
|
|
170
|
+
.reduce((chunk, node) => {
|
|
171
|
+
let code = '';
|
|
172
|
+
switch (node.kind) {
|
|
173
|
+
case 'content':
|
|
174
|
+
code = [
|
|
175
|
+
new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p = __p'),
|
|
176
|
+
...node.content.split('\n').map((line, i, arr) => {
|
|
177
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, '\n + ' + JSON.stringify(line + (i == arr.length - 1 ? '' : '\n')));
|
|
178
|
+
}),
|
|
179
|
+
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ';\n'),
|
|
180
|
+
];
|
|
181
|
+
break;
|
|
182
|
+
case 'interpolate':
|
|
183
|
+
code = [
|
|
184
|
+
new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p += ((__t = '),
|
|
185
|
+
...node.expression.split('\n').map((line, i, arr) => {
|
|
186
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n'));
|
|
187
|
+
}),
|
|
188
|
+
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ') == null ? "" : __t);\n'),
|
|
189
|
+
];
|
|
190
|
+
break;
|
|
191
|
+
case 'escape':
|
|
192
|
+
code = [
|
|
193
|
+
new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p += __e('),
|
|
194
|
+
...node.expression.split('\n').map((line, i, arr) => {
|
|
195
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n'));
|
|
196
|
+
}),
|
|
197
|
+
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ');\n'),
|
|
198
|
+
];
|
|
199
|
+
break;
|
|
200
|
+
case 'evaluate':
|
|
201
|
+
code = [
|
|
202
|
+
...node.expression.split('\n').map((line, i, arr) => {
|
|
203
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n'));
|
|
204
|
+
}),
|
|
205
|
+
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, '\n'),
|
|
206
|
+
];
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
return chunk.add(new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, code));
|
|
210
|
+
}, preamble)
|
|
211
|
+
.add(new source_map_1.SourceNode(end.line, end.column, sourceUrl, [' };\n', '\n', ' return __p;\n', '}\n']));
|
|
212
|
+
const code = nodes.toStringWithSourceMap({
|
|
213
|
+
file: sourceUrl,
|
|
214
|
+
sourceRoot: (options && options.sourceRoot) || '.',
|
|
215
|
+
});
|
|
216
|
+
// Set the source content in the source map, otherwise the sourceUrl is not enough
|
|
217
|
+
// to find the content.
|
|
218
|
+
code.map.setSourceContent(sourceUrl, ast.content);
|
|
219
|
+
return (code.code +
|
|
220
|
+
'\n//# sourceMappingURL=data:application/json;base64,' +
|
|
221
|
+
Buffer.from(code.map.toString()).toString('base64'));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* An equivalent of EJS templates, which is based on John Resig's `tmpl` implementation
|
|
225
|
+
* (http://ejohn.org/blog/javascript-micro-templating/) and Laura Doktorova's doT.js
|
|
226
|
+
* (https://github.com/olado/doT).
|
|
227
|
+
*
|
|
228
|
+
* This version differs from lodash by removing support from ES6 quasi-literals, and making the
|
|
229
|
+
* code slightly simpler to follow. It also does not depend on any third party, which is nice.
|
|
230
|
+
*
|
|
231
|
+
* Finally, it supports SourceMap, if you ever need to debug, which is super nice.
|
|
232
|
+
*
|
|
233
|
+
* @param content The template content.
|
|
234
|
+
* @param options Optional Options. See TemplateOptions for more description.
|
|
235
|
+
* @return {(input: T) => string} A function that accept an input object and returns the content
|
|
236
|
+
* of the template with the input applied.
|
|
237
|
+
*/
|
|
238
|
+
function template(content, options) {
|
|
239
|
+
const sourceUrl = (options && options.sourceURL) || 'ejs';
|
|
240
|
+
const ast = templateParser(content, sourceUrl);
|
|
241
|
+
let source;
|
|
242
|
+
// If there's no need for source map support, we revert back to the fast implementation.
|
|
243
|
+
if (options && options.sourceMap) {
|
|
244
|
+
source = templateWithSourceMap(ast, options);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
source = templateFast(ast, options);
|
|
248
|
+
}
|
|
249
|
+
// We pass a dummy module in case the module option is passed. If `module: true` is passed, we
|
|
250
|
+
// need to only use the source, not the function itself. Otherwise expect a module object to be
|
|
251
|
+
// passed, and we use that one.
|
|
252
|
+
const fn = Function('module', source);
|
|
253
|
+
const module = options && options.module ? (options.module === true ? { exports: {} } : options.module) : null;
|
|
254
|
+
const result = fn(module);
|
|
255
|
+
// Provide the compiled function's source by its `toString` method or
|
|
256
|
+
// the `source` property as a convenience for inlining compiled templates.
|
|
257
|
+
result.source = source;
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["template.ts"],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AC,SAAS,EAAE,CAAC;QACjC,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,8FAA8F;IAC9F,+FAA+F;IAC/F,+BAA+B;IAC/B,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,MAAM,GACV,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClG,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;IAE1B,qEAAqE;IACrE,0EAA0E;IAC1E,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IAEvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { Path } from '../path';
|
|
9
|
+
import { ResolverHost } from './resolver';
|
|
10
|
+
/**
|
|
11
|
+
* A Virtual Host that allow to alias some paths to other paths.
|
|
12
|
+
*
|
|
13
|
+
* This does not verify, when setting an alias, that the target or source exist. Neither does it
|
|
14
|
+
* check whether it's a file or a directory. Please not that directories are also renamed/replaced.
|
|
15
|
+
*
|
|
16
|
+
* No recursion is done on the resolution, which means the following is perfectly valid then:
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
19
|
+
* host.aliases.set(normalize('/file/a'), normalize('/file/b'));
|
|
20
|
+
* host.aliases.set(normalize('/file/b'), normalize('/file/a'));
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* This will result in a proper swap of two files for each others.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const host = new SimpleMemoryHost();
|
|
27
|
+
* host.write(normalize('/some/file'), content).subscribe();
|
|
28
|
+
*
|
|
29
|
+
* const aHost = new AliasHost(host);
|
|
30
|
+
* aHost.read(normalize('/some/file'))
|
|
31
|
+
* .subscribe(x => expect(x).toBe(content));
|
|
32
|
+
* aHost.aliases.set(normalize('/some/file'), normalize('/other/path');
|
|
33
|
+
*
|
|
34
|
+
* // This file will not exist because /other/path does not exist.
|
|
35
|
+
* aHost.read(normalize('/some/file'))
|
|
36
|
+
* .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const host = new SimpleMemoryHost();
|
|
40
|
+
* host.write(normalize('/some/folder/file'), content).subscribe();
|
|
41
|
+
*
|
|
42
|
+
* const aHost = new AliasHost(host);
|
|
43
|
+
* aHost.read(normalize('/some/folder/file'))
|
|
44
|
+
* .subscribe(x => expect(x).toBe(content));
|
|
45
|
+
* aHost.aliases.set(normalize('/some'), normalize('/other');
|
|
46
|
+
*
|
|
47
|
+
* // This file will not exist because /other/path does not exist.
|
|
48
|
+
* aHost.read(normalize('/some/folder/file'))
|
|
49
|
+
* .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
|
|
50
|
+
*
|
|
51
|
+
* // Create the file with new content and verify that this has the new content.
|
|
52
|
+
* aHost.write(normalize('/other/folder/file'), content2).subscribe();
|
|
53
|
+
* aHost.read(normalize('/some/folder/file'))
|
|
54
|
+
* .subscribe(x => expect(x).toBe(content2));
|
|
55
|
+
*/
|
|
56
|
+
export declare class AliasHost<StatsT extends object = {}> extends ResolverHost<StatsT> {
|
|
57
|
+
protected _aliases: Map<Path, Path>;
|
|
58
|
+
protected _resolve(path: Path): Path;
|
|
59
|
+
get aliases(): Map<Path, Path>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AliasHost = void 0;
|
|
11
|
+
const path_1 = require("../path");
|
|
12
|
+
const resolver_1 = require("./resolver");
|
|
13
|
+
/**
|
|
14
|
+
* A Virtual Host that allow to alias some paths to other paths.
|
|
15
|
+
*
|
|
16
|
+
* This does not verify, when setting an alias, that the target or source exist. Neither does it
|
|
17
|
+
* check whether it's a file or a directory. Please not that directories are also renamed/replaced.
|
|
18
|
+
*
|
|
19
|
+
* No recursion is done on the resolution, which means the following is perfectly valid then:
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* host.aliases.set(normalize('/file/a'), normalize('/file/b'));
|
|
23
|
+
* host.aliases.set(normalize('/file/b'), normalize('/file/a'));
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* This will result in a proper swap of two files for each others.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const host = new SimpleMemoryHost();
|
|
30
|
+
* host.write(normalize('/some/file'), content).subscribe();
|
|
31
|
+
*
|
|
32
|
+
* const aHost = new AliasHost(host);
|
|
33
|
+
* aHost.read(normalize('/some/file'))
|
|
34
|
+
* .subscribe(x => expect(x).toBe(content));
|
|
35
|
+
* aHost.aliases.set(normalize('/some/file'), normalize('/other/path');
|
|
36
|
+
*
|
|
37
|
+
* // This file will not exist because /other/path does not exist.
|
|
38
|
+
* aHost.read(normalize('/some/file'))
|
|
39
|
+
* .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const host = new SimpleMemoryHost();
|
|
43
|
+
* host.write(normalize('/some/folder/file'), content).subscribe();
|
|
44
|
+
*
|
|
45
|
+
* const aHost = new AliasHost(host);
|
|
46
|
+
* aHost.read(normalize('/some/folder/file'))
|
|
47
|
+
* .subscribe(x => expect(x).toBe(content));
|
|
48
|
+
* aHost.aliases.set(normalize('/some'), normalize('/other');
|
|
49
|
+
*
|
|
50
|
+
* // This file will not exist because /other/path does not exist.
|
|
51
|
+
* aHost.read(normalize('/some/folder/file'))
|
|
52
|
+
* .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
|
|
53
|
+
*
|
|
54
|
+
* // Create the file with new content and verify that this has the new content.
|
|
55
|
+
* aHost.write(normalize('/other/folder/file'), content2).subscribe();
|
|
56
|
+
* aHost.read(normalize('/some/folder/file'))
|
|
57
|
+
* .subscribe(x => expect(x).toBe(content2));
|
|
58
|
+
*/
|
|
59
|
+
class AliasHost extends resolver_1.ResolverHost {
|
|
60
|
+
_aliases = new Map();
|
|
61
|
+
_resolve(path) {
|
|
62
|
+
let maybeAlias = this._aliases.get(path);
|
|
63
|
+
const sp = (0, path_1.split)(path);
|
|
64
|
+
const remaining = [];
|
|
65
|
+
// Also resolve all parents of the requested files, only picking the first one that matches.
|
|
66
|
+
// This can have surprising behaviour when aliases are inside another alias. It will always
|
|
67
|
+
// use the closest one to the file.
|
|
68
|
+
while (!maybeAlias && sp.length > 0) {
|
|
69
|
+
const p = (0, path_1.join)(path_1.NormalizedRoot, ...sp);
|
|
70
|
+
maybeAlias = this._aliases.get(p);
|
|
71
|
+
if (maybeAlias) {
|
|
72
|
+
maybeAlias = (0, path_1.join)(maybeAlias, ...remaining);
|
|
73
|
+
}
|
|
74
|
+
// Allow non-null-operator because we know sp.length > 0 (condition on while).
|
|
75
|
+
remaining.unshift(sp.pop()); // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
76
|
+
}
|
|
77
|
+
return maybeAlias || path;
|
|
78
|
+
}
|
|
79
|
+
get aliases() {
|
|
80
|
+
return this._aliases;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.AliasHost = AliasHost;
|
|
84
|
+
//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sourceRoot":"","sources":["alias.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,kCAA0E;AAC1E,yCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAa,SAAsC,SAAQ,uBAAoB;IACnE,QAAQ,GAAoB,IAAI,GAAG,EAAE,CAAC;IAEtC,QAAQ,CAAC,IAAU;QAC3B,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,EAAE,GAAG,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC;QACvB,MAAM,SAAS,GAAmB,EAAE,CAAC;QAErC,4FAA4F;QAC5F,2FAA2F;QAC3F,mCAAmC;QACnC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,CAAC,GAAG,IAAA,WAAI,EAAC,qBAAc,EAAE,GAAG,EAAE,CAAC,CAAC;YACtC,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAElC,IAAI,UAAU,EAAE,CAAC;gBACf,UAAU,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,GAAG,SAAS,CAAC,CAAC;YAC9C,CAAC;YACD,8EAA8E;YAC9E,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAG,CAAC,CAAC,CAAC,+DAA+D;QAC/F,CAAC;QAED,OAAO,UAAU,IAAI,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AA5BD,8BA4BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { FileBuffer } from './interface';
|
|
9
|
+
export declare function stringToFileBuffer(str: string): FileBuffer;
|
|
10
|
+
export declare function fileBufferToString(fileBuffer: FileBuffer): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.stringToFileBuffer = stringToFileBuffer;
|
|
11
|
+
exports.fileBufferToString = fileBufferToString;
|
|
12
|
+
const node_util_1 = require("node:util");
|
|
13
|
+
function stringToFileBuffer(str) {
|
|
14
|
+
return new node_util_1.TextEncoder().encode(str).buffer;
|
|
15
|
+
}
|
|
16
|
+
function fileBufferToString(fileBuffer) {
|
|
17
|
+
if (fileBuffer.toString.length === 1) {
|
|
18
|
+
return fileBuffer.toString('utf-8');
|
|
19
|
+
}
|
|
20
|
+
return new node_util_1.TextDecoder('utf-8').decode(new Uint8Array(fileBuffer));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["buffer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH,gDAEC;AAED,gDAMC;AAbD,yCAAqD;AAGrD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,IAAI,uBAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED,SAAgB,kBAAkB,CAAC,UAAsB;IACvD,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAQ,UAAU,CAAC,QAAoC,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,IAAI,uBAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { Path, PathFragment } from '../path';
|
|
9
|
+
import { FileBuffer, FileBufferLike, Host, Stats } from './interface';
|
|
10
|
+
export interface SyncHostHandler<StatsT extends object = {}> {
|
|
11
|
+
read(path: Path): FileBuffer;
|
|
12
|
+
list(path: Path): PathFragment[];
|
|
13
|
+
exists(path: Path): boolean;
|
|
14
|
+
isDirectory(path: Path): boolean;
|
|
15
|
+
isFile(path: Path): boolean;
|
|
16
|
+
stat(path: Path): Stats<StatsT> | null;
|
|
17
|
+
write(path: Path, content: FileBufferLike): void;
|
|
18
|
+
delete(path: Path): void;
|
|
19
|
+
rename(from: Path, to: Path): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function createSyncHost<StatsT extends object = {}>(handler: SyncHostHandler<StatsT>): Host<StatsT>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createSyncHost = createSyncHost;
|
|
11
|
+
const rxjs_1 = require("rxjs");
|
|
12
|
+
function wrapAction(action) {
|
|
13
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
14
|
+
subscriber.next(action());
|
|
15
|
+
subscriber.complete();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function createSyncHost(handler) {
|
|
19
|
+
return new (class {
|
|
20
|
+
get capabilities() {
|
|
21
|
+
return { synchronous: true };
|
|
22
|
+
}
|
|
23
|
+
read(path) {
|
|
24
|
+
return wrapAction(() => handler.read(path));
|
|
25
|
+
}
|
|
26
|
+
list(path) {
|
|
27
|
+
return wrapAction(() => handler.list(path));
|
|
28
|
+
}
|
|
29
|
+
exists(path) {
|
|
30
|
+
return wrapAction(() => handler.exists(path));
|
|
31
|
+
}
|
|
32
|
+
isDirectory(path) {
|
|
33
|
+
return wrapAction(() => handler.isDirectory(path));
|
|
34
|
+
}
|
|
35
|
+
isFile(path) {
|
|
36
|
+
return wrapAction(() => handler.isFile(path));
|
|
37
|
+
}
|
|
38
|
+
stat(path) {
|
|
39
|
+
return wrapAction(() => handler.stat(path));
|
|
40
|
+
}
|
|
41
|
+
write(path, content) {
|
|
42
|
+
return wrapAction(() => handler.write(path, content));
|
|
43
|
+
}
|
|
44
|
+
delete(path) {
|
|
45
|
+
return wrapAction(() => handler.delete(path));
|
|
46
|
+
}
|
|
47
|
+
rename(from, to) {
|
|
48
|
+
return wrapAction(() => handler.rename(from, to));
|
|
49
|
+
}
|
|
50
|
+
watch() {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
})();
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":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AAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,CAAC,IAAU;YACf,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,CAAC,IAAU,EAAE,EAAQ;YACzB,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,KAAK;YACH,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC,EAAE,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { Observable } from 'rxjs';
|
|
9
|
+
import { Path, PathFragment } from '../path';
|
|
10
|
+
import { FileBuffer, HostCapabilities, ReadonlyHost, Stats } from './interface';
|
|
11
|
+
export declare class Empty implements ReadonlyHost {
|
|
12
|
+
readonly capabilities: HostCapabilities;
|
|
13
|
+
read(path: Path): Observable<FileBuffer>;
|
|
14
|
+
list(path: Path): Observable<PathFragment[]>;
|
|
15
|
+
exists(path: Path): Observable<boolean>;
|
|
16
|
+
isDirectory(path: Path): Observable<boolean>;
|
|
17
|
+
isFile(path: Path): Observable<boolean>;
|
|
18
|
+
stat(path: Path): Observable<Stats<{}> | null>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.Empty = void 0;
|
|
11
|
+
const rxjs_1 = require("rxjs");
|
|
12
|
+
const exception_1 = require("../../exception");
|
|
13
|
+
class Empty {
|
|
14
|
+
capabilities = {
|
|
15
|
+
synchronous: true,
|
|
16
|
+
};
|
|
17
|
+
read(path) {
|
|
18
|
+
return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path));
|
|
19
|
+
}
|
|
20
|
+
list(path) {
|
|
21
|
+
return (0, rxjs_1.of)([]);
|
|
22
|
+
}
|
|
23
|
+
exists(path) {
|
|
24
|
+
return (0, rxjs_1.of)(false);
|
|
25
|
+
}
|
|
26
|
+
isDirectory(path) {
|
|
27
|
+
return (0, rxjs_1.of)(false);
|
|
28
|
+
}
|
|
29
|
+
isFile(path) {
|
|
30
|
+
return (0, rxjs_1.of)(false);
|
|
31
|
+
}
|
|
32
|
+
stat(path) {
|
|
33
|
+
// We support stat() but have no file.
|
|
34
|
+
return (0, rxjs_1.of)(null);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Empty = Empty;
|
|
38
|
+
//# sourceMappingURL=empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.js","sourceRoot":"","sources":["empty.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+BAAkD;AAClD,+CAA4D;AAI5D,MAAa,KAAK;IACP,YAAY,GAAqB;QACxC,WAAW,EAAE,IAAI;KAClB,CAAC;IAEF,IAAI,CAAC,IAAU;QACb,OAAO,IAAA,iBAAU,EAAC,IAAI,qCAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,IAAU;QACb,OAAO,IAAA,SAAE,EAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,IAAU;QACf,OAAO,IAAA,SAAE,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,IAAU;QACpB,OAAO,IAAA,SAAE,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,IAAU;QACf,OAAO,IAAA,SAAE,EAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,IAAU;QACb,sCAAsC;QACtC,OAAO,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;IAClB,CAAC;CACF;AA7BD,sBA6BC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import * as test from './test';
|
|
9
|
+
export * from './alias';
|
|
10
|
+
export * from './buffer';
|
|
11
|
+
export * from './create';
|
|
12
|
+
export * from './empty';
|
|
13
|
+
export * from './interface';
|
|
14
|
+
export * from './memory';
|
|
15
|
+
export * from './pattern';
|
|
16
|
+
export * from './record';
|
|
17
|
+
export * from './safe';
|
|
18
|
+
export * from './scoped';
|
|
19
|
+
export * from './sync';
|
|
20
|
+
export * from './resolver';
|
|
21
|
+
export { test };
|