Conexio amb la api
This commit is contained in:
parent
207c0ba819
commit
b12369cb47
48513 changed files with 7391639 additions and 7 deletions
63
node_modules/@angular-devkit/core/node/BUILD.bazel
generated
vendored
Executable file
63
node_modules/@angular-devkit/core/node/BUILD.bazel
generated
vendored
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
|
||||
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
licenses(["notice"]) # MIT License
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "node",
|
||||
srcs = glob(
|
||||
include = ["**/*.ts"],
|
||||
exclude = [
|
||||
"testing/**/*.ts",
|
||||
"**/*_spec.ts",
|
||||
"**/*_benchmark.ts",
|
||||
],
|
||||
),
|
||||
module_name = "@angular-devkit/core/node",
|
||||
module_root = "index.d.ts",
|
||||
# The attribute below is needed in g3 to turn off strict typechecking
|
||||
# strict_checks = False,
|
||||
deps = [
|
||||
"//packages/angular_devkit/core",
|
||||
"@npm//@types/node",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "node_test_lib",
|
||||
testonly = True,
|
||||
srcs = glob(
|
||||
include = [
|
||||
"**/*_spec.ts",
|
||||
],
|
||||
exclude = [
|
||||
"testing/**/*.ts",
|
||||
],
|
||||
),
|
||||
deps = [
|
||||
":node",
|
||||
"//packages/angular_devkit/core",
|
||||
"//tests/angular_devkit/core/node/jobs:jobs_test_lib",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
name = "node_test",
|
||||
srcs = [":node_test_lib"],
|
||||
deps = [
|
||||
"@npm//chokidar",
|
||||
"@npm//temp",
|
||||
# @node_module: ajv
|
||||
# @node_module: fast_json_stable_stringify
|
||||
# @node_module: magic_string
|
||||
],
|
||||
)
|
||||
11
node_modules/@angular-devkit/core/node/_golden-api.d.ts
generated
vendored
Executable file
11
node_modules/@angular-devkit/core/node/_golden-api.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './experimental/jobs/job-registry';
|
||||
export * from './fs';
|
||||
export * from './cli-logger';
|
||||
export * from './host';
|
||||
27
node_modules/@angular-devkit/core/node/_golden-api.js
generated
vendored
Executable file
27
node_modules/@angular-devkit/core/node/_golden-api.js
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// Start experimental namespace
|
||||
// Start jobs namespace
|
||||
__exportStar(require("./experimental/jobs/job-registry"), exports);
|
||||
// End jobs namespace
|
||||
// End experimental namespace
|
||||
__exportStar(require("./fs"), exports);
|
||||
__exportStar(require("./cli-logger"), exports);
|
||||
__exportStar(require("./host"), exports);
|
||||
16
node_modules/@angular-devkit/core/node/cli-logger.d.ts
generated
vendored
Executable file
16
node_modules/@angular-devkit/core/node/cli-logger.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { logging } from '../src';
|
||||
export interface ProcessOutput {
|
||||
write(buffer: string | Buffer): boolean;
|
||||
}
|
||||
/**
|
||||
* A Logger that sends information to STDOUT and STDERR.
|
||||
*/
|
||||
export declare function createConsoleLogger(verbose?: boolean, stdout?: ProcessOutput, stderr?: ProcessOutput, colors?: Partial<Record<logging.LogLevel, (s: string) => string>>): logging.Logger;
|
||||
58
node_modules/@angular-devkit/core/node/cli-logger.js
generated
vendored
Executable file
58
node_modules/@angular-devkit/core/node/cli-logger.js
generated
vendored
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createConsoleLogger = void 0;
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const src_1 = require("../src");
|
||||
/**
|
||||
* A Logger that sends information to STDOUT and STDERR.
|
||||
*/
|
||||
function createConsoleLogger(verbose = false, stdout = process.stdout, stderr = process.stderr, colors) {
|
||||
const logger = new src_1.logging.IndentLogger('cling');
|
||||
logger.pipe(operators_1.filter((entry) => entry.level !== 'debug' || verbose)).subscribe((entry) => {
|
||||
const color = colors && colors[entry.level];
|
||||
let output = stdout;
|
||||
switch (entry.level) {
|
||||
case 'warn':
|
||||
case 'fatal':
|
||||
case 'error':
|
||||
output = stderr;
|
||||
break;
|
||||
}
|
||||
// If we do console.log(message) or process.stdout.write(message + '\n'), the process might
|
||||
// stop before the whole message is written and the stream is flushed. This happens when
|
||||
// streams are asynchronous.
|
||||
//
|
||||
// NodeJS IO streams are different depending on platform and usage. In POSIX environment,
|
||||
// for example, they're asynchronous when writing to a pipe, but synchronous when writing
|
||||
// to a TTY. In windows, it's the other way around. You can verify which is which with
|
||||
// stream.isTTY and platform, but this is not good enough.
|
||||
// In the async case, one should wait for the callback before sending more data or
|
||||
// continuing the process. In our case it would be rather hard to do (but not impossible).
|
||||
//
|
||||
// Instead we take the easy way out and simply chunk the message and call the write
|
||||
// function while the buffer drain itself asynchronously. With a smaller chunk size than
|
||||
// the buffer, we are mostly certain that it works. In this case, the chunk has been picked
|
||||
// as half a page size (4096/2 = 2048), minus some bytes for the color formatting.
|
||||
// On POSIX it seems the buffer is 2 pages (8192), but just to be sure (could be different
|
||||
// by platform).
|
||||
//
|
||||
// For more details, see https://nodejs.org/api/process.html#process_a_note_on_process_i_o
|
||||
const chunkSize = 2000; // Small chunk.
|
||||
let message = entry.message;
|
||||
while (message) {
|
||||
const chunk = message.slice(0, chunkSize);
|
||||
message = message.slice(chunkSize);
|
||||
output.write(color ? color(chunk) : chunk);
|
||||
}
|
||||
output.write('\n');
|
||||
});
|
||||
return logger;
|
||||
}
|
||||
exports.createConsoleLogger = createConsoleLogger;
|
||||
9
node_modules/@angular-devkit/core/node/experimental/index.d.ts
generated
vendored
Executable file
9
node_modules/@angular-devkit/core/node/experimental/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import * as jobs from './jobs';
|
||||
export { jobs };
|
||||
31
node_modules/@angular-devkit/core/node/experimental/index.js
generated
vendored
Executable file
31
node_modules/@angular-devkit/core/node/experimental/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jobs = void 0;
|
||||
const jobs = __importStar(require("./jobs"));
|
||||
exports.jobs = jobs;
|
||||
8
node_modules/@angular-devkit/core/node/experimental/jobs/index.d.ts
generated
vendored
Executable file
8
node_modules/@angular-devkit/core/node/experimental/jobs/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
export * from './job-registry';
|
||||
20
node_modules/@angular-devkit/core/node/experimental/jobs/index.js
generated
vendored
Executable file
20
node_modules/@angular-devkit/core/node/experimental/jobs/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./job-registry"), exports);
|
||||
19
node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.d.ts
generated
vendored
Executable file
19
node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import { Observable } from 'rxjs';
|
||||
import { JsonValue, experimental as core_experimental } from '../../../src';
|
||||
export declare class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = JsonValue, MinimumInputValueT extends JsonValue = JsonValue, MinimumOutputValueT extends JsonValue = JsonValue> implements core_experimental.jobs.Registry<MinimumArgumentValueT, MinimumInputValueT, MinimumOutputValueT> {
|
||||
protected _resolve(name: string): string | null;
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if the job is not registered.
|
||||
*/
|
||||
get<A extends MinimumArgumentValueT, I extends MinimumInputValueT, O extends MinimumOutputValueT>(name: core_experimental.jobs.JobName): Observable<core_experimental.jobs.JobHandler<A, I, O> | null>;
|
||||
}
|
||||
59
node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.js
generated
vendored
Executable file
59
node_modules/@angular-devkit/core/node/experimental/jobs/job-registry.js
generated
vendored
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeModuleJobRegistry = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const src_1 = require("../../../src");
|
||||
class NodeModuleJobRegistry {
|
||||
_resolve(name) {
|
||||
try {
|
||||
return require.resolve(name);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get a job description for a named job.
|
||||
*
|
||||
* @param name The name of the job.
|
||||
* @returns A description, or null if the job is not registered.
|
||||
*/
|
||||
get(name) {
|
||||
const [moduleName, exportName] = name.split(/#/, 2);
|
||||
const resolvedPath = this._resolve(moduleName);
|
||||
if (!resolvedPath) {
|
||||
return rxjs_1.of(null);
|
||||
}
|
||||
const pkg = require(resolvedPath);
|
||||
const handler = pkg[exportName || 'default'];
|
||||
if (!handler) {
|
||||
return rxjs_1.of(null);
|
||||
}
|
||||
function _getValue(...fields) {
|
||||
return fields.find((x) => src_1.schema.isJsonSchema(x)) || true;
|
||||
}
|
||||
const argument = _getValue(pkg.argument, handler.argument);
|
||||
const input = _getValue(pkg.input, handler.input);
|
||||
const output = _getValue(pkg.output, handler.output);
|
||||
const channels = _getValue(pkg.channels, handler.channels);
|
||||
return rxjs_1.of(Object.assign(handler.bind(undefined), {
|
||||
jobDescription: {
|
||||
argument,
|
||||
input,
|
||||
output,
|
||||
channels,
|
||||
},
|
||||
}));
|
||||
}
|
||||
}
|
||||
exports.NodeModuleJobRegistry = NodeModuleJobRegistry;
|
||||
11
node_modules/@angular-devkit/core/node/fs.d.ts
generated
vendored
Executable file
11
node_modules/@angular-devkit/core/node/fs.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/** @deprecated Since v11.0, unused by the Angular tooling */
|
||||
export declare function isFile(filePath: string): boolean;
|
||||
/** @deprecated Since v11.0, unused by the Angular tooling */
|
||||
export declare function isDirectory(filePath: string): boolean;
|
||||
41
node_modules/@angular-devkit/core/node/fs.js
generated
vendored
Executable file
41
node_modules/@angular-devkit/core/node/fs.js
generated
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isDirectory = exports.isFile = void 0;
|
||||
const fs_1 = require("fs");
|
||||
/** @deprecated Since v11.0, unused by the Angular tooling */
|
||||
function isFile(filePath) {
|
||||
let stat;
|
||||
try {
|
||||
stat = fs_1.statSync(filePath);
|
||||
}
|
||||
catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return stat.isFile() || stat.isFIFO();
|
||||
}
|
||||
exports.isFile = isFile;
|
||||
/** @deprecated Since v11.0, unused by the Angular tooling */
|
||||
function isDirectory(filePath) {
|
||||
let stat;
|
||||
try {
|
||||
stat = fs_1.statSync(filePath);
|
||||
}
|
||||
catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) {
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return stat.isDirectory();
|
||||
}
|
||||
exports.isDirectory = isDirectory;
|
||||
44
node_modules/@angular-devkit/core/node/host.d.ts
generated
vendored
Executable file
44
node_modules/@angular-devkit/core/node/host.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import { Stats } from 'fs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Path, PathFragment, virtualFs } from '../src';
|
||||
/**
|
||||
* An implementation of the Virtual FS using Node as the background. There are two versions; one
|
||||
* synchronous and one asynchronous.
|
||||
*/
|
||||
export declare class NodeJsAsyncHost implements virtualFs.Host<Stats> {
|
||||
get capabilities(): virtualFs.HostCapabilities;
|
||||
write(path: Path, content: virtualFs.FileBuffer): Observable<void>;
|
||||
read(path: Path): Observable<virtualFs.FileBuffer>;
|
||||
delete(path: Path): Observable<void>;
|
||||
rename(from: Path, to: Path): Observable<void>;
|
||||
list(path: Path): Observable<PathFragment[]>;
|
||||
exists(path: Path): Observable<boolean>;
|
||||
isDirectory(path: Path): Observable<boolean>;
|
||||
isFile(path: Path): Observable<boolean>;
|
||||
stat(path: Path): Observable<virtualFs.Stats<Stats>>;
|
||||
watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable<virtualFs.HostWatchEvent> | null;
|
||||
}
|
||||
/**
|
||||
* An implementation of the Virtual FS using Node as the backend, synchronously.
|
||||
*/
|
||||
export declare class NodeJsSyncHost implements virtualFs.Host<Stats> {
|
||||
get capabilities(): virtualFs.HostCapabilities;
|
||||
write(path: Path, content: virtualFs.FileBuffer): Observable<void>;
|
||||
read(path: Path): Observable<virtualFs.FileBuffer>;
|
||||
delete(path: Path): Observable<void>;
|
||||
rename(from: Path, to: Path): Observable<void>;
|
||||
list(path: Path): Observable<PathFragment[]>;
|
||||
exists(path: Path): Observable<boolean>;
|
||||
isDirectory(path: Path): Observable<boolean>;
|
||||
isFile(path: Path): Observable<boolean>;
|
||||
stat(path: Path): Observable<virtualFs.Stats<Stats>>;
|
||||
watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable<virtualFs.HostWatchEvent> | null;
|
||||
}
|
||||
244
node_modules/@angular-devkit/core/node/host.js
generated
vendored
Executable file
244
node_modules/@angular-devkit/core/node/host.js
generated
vendored
Executable file
|
|
@ -0,0 +1,244 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeJsSyncHost = exports.NodeJsAsyncHost = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const src_1 = require("../src");
|
||||
async function exists(path) {
|
||||
try {
|
||||
await fs_1.promises.access(path, fs_1.constants.F_OK);
|
||||
return true;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// This will only be initialized if the watch() method is called.
|
||||
// Otherwise chokidar appears only in type positions, and shouldn't be referenced
|
||||
// in the JavaScript output.
|
||||
let FSWatcher;
|
||||
function loadFSWatcher() {
|
||||
if (!FSWatcher) {
|
||||
try {
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
FSWatcher = require('chokidar').FSWatcher;
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw new Error('As of angular-devkit version 8.0, the "chokidar" package ' +
|
||||
'must be installed in order to use watch() features.');
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* An implementation of the Virtual FS using Node as the background. There are two versions; one
|
||||
* synchronous and one asynchronous.
|
||||
*/
|
||||
class NodeJsAsyncHost {
|
||||
get capabilities() {
|
||||
return { synchronous: false };
|
||||
}
|
||||
write(path, content) {
|
||||
return rxjs_1.from(fs_1.promises.mkdir(src_1.getSystemPath(src_1.dirname(path)), { recursive: true })).pipe(operators_1.mergeMap(() => fs_1.promises.writeFile(src_1.getSystemPath(path), new Uint8Array(content))));
|
||||
}
|
||||
read(path) {
|
||||
return rxjs_1.from(fs_1.promises.readFile(src_1.getSystemPath(path))).pipe(operators_1.map((buffer) => new Uint8Array(buffer).buffer));
|
||||
}
|
||||
delete(path) {
|
||||
return this.isDirectory(path).pipe(operators_1.mergeMap(async (isDirectory) => {
|
||||
if (isDirectory) {
|
||||
const recursiveDelete = async (dirPath) => {
|
||||
for (const fragment of await fs_1.promises.readdir(dirPath)) {
|
||||
const sysPath = path_1.join(dirPath, fragment);
|
||||
const stats = await fs_1.promises.stat(sysPath);
|
||||
if (stats.isDirectory()) {
|
||||
await recursiveDelete(sysPath);
|
||||
await fs_1.promises.rmdir(sysPath);
|
||||
}
|
||||
else {
|
||||
await fs_1.promises.unlink(sysPath);
|
||||
}
|
||||
}
|
||||
};
|
||||
await recursiveDelete(src_1.getSystemPath(path));
|
||||
}
|
||||
else {
|
||||
await fs_1.promises.unlink(src_1.getSystemPath(path));
|
||||
}
|
||||
}));
|
||||
}
|
||||
rename(from, to) {
|
||||
return rxjs_1.from(fs_1.promises.rename(src_1.getSystemPath(from), src_1.getSystemPath(to)));
|
||||
}
|
||||
list(path) {
|
||||
return rxjs_1.from(fs_1.promises.readdir(src_1.getSystemPath(path))).pipe(operators_1.map((names) => names.map((name) => src_1.fragment(name))));
|
||||
}
|
||||
exists(path) {
|
||||
return rxjs_1.from(exists(src_1.getSystemPath(path)));
|
||||
}
|
||||
isDirectory(path) {
|
||||
return this.stat(path).pipe(operators_1.map((stat) => stat.isDirectory()));
|
||||
}
|
||||
isFile(path) {
|
||||
return this.stat(path).pipe(operators_1.map((stat) => stat.isFile()));
|
||||
}
|
||||
// Some hosts may not support stat.
|
||||
stat(path) {
|
||||
return rxjs_1.from(fs_1.promises.stat(src_1.getSystemPath(path)));
|
||||
}
|
||||
// Some hosts may not support watching.
|
||||
watch(path, _options) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
loadFSWatcher();
|
||||
const watcher = new FSWatcher({ persistent: true }).add(src_1.getSystemPath(path));
|
||||
watcher
|
||||
.on('change', (path) => {
|
||||
obs.next({
|
||||
path: src_1.normalize(path),
|
||||
time: new Date(),
|
||||
type: 0 /* Changed */,
|
||||
});
|
||||
})
|
||||
.on('add', (path) => {
|
||||
obs.next({
|
||||
path: src_1.normalize(path),
|
||||
time: new Date(),
|
||||
type: 1 /* Created */,
|
||||
});
|
||||
})
|
||||
.on('unlink', (path) => {
|
||||
obs.next({
|
||||
path: src_1.normalize(path),
|
||||
time: new Date(),
|
||||
type: 2 /* Deleted */,
|
||||
});
|
||||
});
|
||||
return () => watcher.close();
|
||||
}).pipe(operators_1.publish(), operators_1.refCount());
|
||||
}
|
||||
}
|
||||
exports.NodeJsAsyncHost = NodeJsAsyncHost;
|
||||
/**
|
||||
* An implementation of the Virtual FS using Node as the backend, synchronously.
|
||||
*/
|
||||
class NodeJsSyncHost {
|
||||
get capabilities() {
|
||||
return { synchronous: true };
|
||||
}
|
||||
write(path, content) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
fs_1.mkdirSync(src_1.getSystemPath(src_1.dirname(path)), { recursive: true });
|
||||
fs_1.writeFileSync(src_1.getSystemPath(path), new Uint8Array(content));
|
||||
obs.next();
|
||||
obs.complete();
|
||||
});
|
||||
}
|
||||
read(path) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
const buffer = fs_1.readFileSync(src_1.getSystemPath(path));
|
||||
obs.next(new Uint8Array(buffer).buffer);
|
||||
obs.complete();
|
||||
});
|
||||
}
|
||||
delete(path) {
|
||||
return this.isDirectory(path).pipe(operators_1.concatMap((isDir) => {
|
||||
if (isDir) {
|
||||
const dirPaths = fs_1.readdirSync(src_1.getSystemPath(path));
|
||||
const rmDirComplete = new rxjs_1.Observable((obs) => {
|
||||
fs_1.rmdirSync(src_1.getSystemPath(path));
|
||||
obs.complete();
|
||||
});
|
||||
return rxjs_1.concat(...dirPaths.map((name) => this.delete(src_1.join(path, name))), rmDirComplete);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
fs_1.unlinkSync(src_1.getSystemPath(path));
|
||||
}
|
||||
catch (err) {
|
||||
return rxjs_1.throwError(err);
|
||||
}
|
||||
return rxjs_1.of(undefined);
|
||||
}
|
||||
}));
|
||||
}
|
||||
rename(from, to) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
const toSystemPath = src_1.getSystemPath(to);
|
||||
fs_1.mkdirSync(path_1.dirname(toSystemPath), { recursive: true });
|
||||
fs_1.renameSync(src_1.getSystemPath(from), toSystemPath);
|
||||
obs.next();
|
||||
obs.complete();
|
||||
});
|
||||
}
|
||||
list(path) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
const names = fs_1.readdirSync(src_1.getSystemPath(path));
|
||||
obs.next(names.map((name) => src_1.fragment(name)));
|
||||
obs.complete();
|
||||
});
|
||||
}
|
||||
exists(path) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
obs.next(fs_1.existsSync(src_1.getSystemPath(path)));
|
||||
obs.complete();
|
||||
});
|
||||
}
|
||||
isDirectory(path) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return this.stat(path).pipe(operators_1.map((stat) => stat.isDirectory()));
|
||||
}
|
||||
isFile(path) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return this.stat(path).pipe(operators_1.map((stat) => stat.isFile()));
|
||||
}
|
||||
// Some hosts may not support stat.
|
||||
stat(path) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
obs.next(fs_1.statSync(src_1.getSystemPath(path)));
|
||||
obs.complete();
|
||||
});
|
||||
}
|
||||
// Some hosts may not support watching.
|
||||
watch(path, _options) {
|
||||
return new rxjs_1.Observable((obs) => {
|
||||
const opts = { persistent: false };
|
||||
loadFSWatcher();
|
||||
const watcher = new FSWatcher(opts).add(src_1.getSystemPath(path));
|
||||
watcher
|
||||
.on('change', (path) => {
|
||||
obs.next({
|
||||
path: src_1.normalize(path),
|
||||
time: new Date(),
|
||||
type: 0 /* Changed */,
|
||||
});
|
||||
})
|
||||
.on('add', (path) => {
|
||||
obs.next({
|
||||
path: src_1.normalize(path),
|
||||
time: new Date(),
|
||||
type: 1 /* Created */,
|
||||
});
|
||||
})
|
||||
.on('unlink', (path) => {
|
||||
obs.next({
|
||||
path: src_1.normalize(path),
|
||||
time: new Date(),
|
||||
type: 2 /* Deleted */,
|
||||
});
|
||||
});
|
||||
return () => watcher.close();
|
||||
}).pipe(operators_1.publish(), operators_1.refCount());
|
||||
}
|
||||
}
|
||||
exports.NodeJsSyncHost = NodeJsSyncHost;
|
||||
12
node_modules/@angular-devkit/core/node/index.d.ts
generated
vendored
Executable file
12
node_modules/@angular-devkit/core/node/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import * as experimental from './experimental/jobs/job-registry';
|
||||
import * as fs from './fs';
|
||||
export * from './cli-logger';
|
||||
export * from './host';
|
||||
export { experimental, fs };
|
||||
38
node_modules/@angular-devkit/core/node/index.js
generated
vendored
Executable file
38
node_modules/@angular-devkit/core/node/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fs = exports.experimental = void 0;
|
||||
const experimental = __importStar(require("./experimental/jobs/job-registry"));
|
||||
exports.experimental = experimental;
|
||||
const fs = __importStar(require("./fs"));
|
||||
exports.fs = fs;
|
||||
__exportStar(require("./cli-logger"), exports);
|
||||
__exportStar(require("./host"), exports);
|
||||
31
node_modules/@angular-devkit/core/node/testing/BUILD.bazel
generated
vendored
Executable file
31
node_modules/@angular-devkit/core/node/testing/BUILD.bazel
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
# Copyright Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
licenses(["notice"]) # MIT License
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "testing",
|
||||
srcs = glob(
|
||||
include = ["**/*.ts"],
|
||||
exclude = [
|
||||
"**/*_spec.ts",
|
||||
"**/*_benchmark.ts",
|
||||
],
|
||||
),
|
||||
module_name = "@angular-devkit/core/node/testing",
|
||||
module_root = "index.d.ts",
|
||||
# The attribute below is needed in g3 to turn off strict typechecking
|
||||
# strict_checks = False,
|
||||
deps = [
|
||||
"//packages/angular_devkit/core",
|
||||
"//packages/angular_devkit/core/node",
|
||||
"@npm//@types/jasmine",
|
||||
"@npm//@types/node",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
21
node_modules/@angular-devkit/core/node/testing/index.d.ts
generated
vendored
Executable file
21
node_modules/@angular-devkit/core/node/testing/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import { Path, virtualFs } from '../../src';
|
||||
/**
|
||||
* A Sync Scoped Host that creates a temporary directory and scope to it.
|
||||
*/
|
||||
export declare class TempScopedNodeJsSyncHost extends virtualFs.ScopedHost<fs.Stats> {
|
||||
protected _sync?: virtualFs.SyncDelegateHost<fs.Stats>;
|
||||
protected _root: Path;
|
||||
constructor();
|
||||
get files(): Path[];
|
||||
get root(): Path;
|
||||
get sync(): virtualFs.SyncDelegateHost<fs.Stats>;
|
||||
}
|
||||
72
node_modules/@angular-devkit/core/node/testing/index.js
generated
vendored
Executable file
72
node_modules/@angular-devkit/core/node/testing/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TempScopedNodeJsSyncHost = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const src_1 = require("../../src");
|
||||
const host_1 = require("../host");
|
||||
/**
|
||||
* A Sync Scoped Host that creates a temporary directory and scope to it.
|
||||
*/
|
||||
class TempScopedNodeJsSyncHost extends src_1.virtualFs.ScopedHost {
|
||||
constructor() {
|
||||
const root = src_1.normalize(path.join(os.tmpdir(), `devkit-host-${+Date.now()}-${process.pid}`));
|
||||
fs.mkdirSync(src_1.getSystemPath(root));
|
||||
super(new host_1.NodeJsSyncHost(), root);
|
||||
this._root = root;
|
||||
}
|
||||
get files() {
|
||||
const sync = this.sync;
|
||||
function _visit(p) {
|
||||
return sync
|
||||
.list(p)
|
||||
.map((fragment) => src_1.join(p, fragment))
|
||||
.reduce((files, path) => {
|
||||
if (sync.isDirectory(path)) {
|
||||
return files.concat(_visit(path));
|
||||
}
|
||||
else {
|
||||
return files.concat(path);
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
return _visit(src_1.normalize('/'));
|
||||
}
|
||||
get root() {
|
||||
return this._root;
|
||||
}
|
||||
get sync() {
|
||||
if (!this._sync) {
|
||||
this._sync = new src_1.virtualFs.SyncDelegateHost(this);
|
||||
}
|
||||
return this._sync;
|
||||
}
|
||||
}
|
||||
exports.TempScopedNodeJsSyncHost = TempScopedNodeJsSyncHost;
|
||||
Loading…
Add table
Add a link
Reference in a new issue