oc 0.49.26 → 0.49.28
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/CHANGELOG.md +10 -0
- package/dist/cli/commands.d.ts +163 -163
- package/dist/cli/commands.js +162 -162
- package/dist/cli/domain/clean.d.ts +2 -2
- package/dist/cli/domain/clean.js +24 -24
- package/dist/cli/domain/get-components-by-dir.d.ts +1 -1
- package/dist/cli/domain/get-components-by-dir.js +41 -41
- package/dist/cli/domain/get-mocked-plugins.d.ts +10 -10
- package/dist/cli/domain/get-mocked-plugins.js +88 -88
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.d.ts +6 -6
- package/dist/cli/domain/handle-dependencies/ensure-compiler-is-declared-as-devDependency.js +15 -15
- package/dist/cli/domain/handle-dependencies/get-compiler.d.ts +10 -10
- package/dist/cli/domain/handle-dependencies/get-compiler.js +28 -28
- package/dist/cli/domain/handle-dependencies/get-missing-dependencies.d.ts +1 -1
- package/dist/cli/domain/handle-dependencies/get-missing-dependencies.js +18 -18
- package/dist/cli/domain/handle-dependencies/index.d.ts +10 -10
- package/dist/cli/domain/handle-dependencies/index.js +70 -70
- package/dist/cli/domain/handle-dependencies/install-compiler.d.ts +8 -8
- package/dist/cli/domain/handle-dependencies/install-compiler.js +58 -58
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.d.ts +5 -5
- package/dist/cli/domain/handle-dependencies/install-missing-dependencies.js +63 -63
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.d.ts +6 -6
- package/dist/cli/domain/handle-dependencies/link-missing-dependencies.js +32 -32
- package/dist/cli/domain/handle-dependencies/require-template.d.ts +17 -17
- package/dist/cli/domain/handle-dependencies/require-template.js +34 -34
- package/dist/cli/domain/init-template/index.d.ts +10 -10
- package/dist/cli/domain/init-template/index.js +44 -44
- package/dist/cli/domain/init-template/install-template.d.ts +11 -11
- package/dist/cli/domain/init-template/install-template.js +58 -58
- package/dist/cli/domain/init-template/scaffold.d.ts +11 -11
- package/dist/cli/domain/init-template/scaffold.js +34 -34
- package/dist/cli/domain/local.d.ts +21 -21
- package/dist/cli/domain/local.js +86 -86
- package/dist/cli/domain/mock.d.ts +5 -5
- package/dist/cli/domain/mock.js +33 -33
- package/dist/cli/domain/package-components.d.ts +9 -9
- package/dist/cli/domain/package-components.js +71 -71
- package/dist/cli/domain/registry.d.ts +20 -20
- package/dist/cli/domain/registry.js +143 -143
- package/dist/cli/domain/url-parser.d.ts +14 -14
- package/dist/cli/domain/url-parser.js +31 -31
- package/dist/cli/domain/watch.d.ts +1 -1
- package/dist/cli/domain/watch.js +29 -29
- package/dist/cli/facade/clean.d.ts +16 -16
- package/dist/cli/facade/clean.js +58 -58
- package/dist/cli/facade/dev.d.ts +146 -114
- package/dist/cli/facade/dev.js +177 -177
- package/dist/cli/facade/init.d.ts +18 -18
- package/dist/cli/facade/init.js +39 -39
- package/dist/cli/facade/mock.d.ts +18 -18
- package/dist/cli/facade/mock.js +12 -12
- package/dist/cli/facade/package.d.ts +19 -19
- package/dist/cli/facade/package.js +49 -49
- package/dist/cli/facade/preview.d.ts +14 -14
- package/dist/cli/facade/preview.js +20 -20
- package/dist/cli/facade/publish.d.ts +24 -24
- package/dist/cli/facade/publish.js +145 -145
- package/dist/cli/facade/registry-add.d.ts +14 -14
- package/dist/cli/facade/registry-add.js +18 -18
- package/dist/cli/facade/registry-ls.d.ts +10 -10
- package/dist/cli/facade/registry-ls.js +27 -27
- package/dist/cli/facade/registry-remove.d.ts +14 -14
- package/dist/cli/facade/registry-remove.js +18 -18
- package/dist/cli/facade/registry.d.ts +5 -5
- package/dist/cli/facade/registry.js +9 -9
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +91 -91
- package/dist/cli/logger.d.ts +8 -8
- package/dist/cli/logger.js +19 -19
- package/dist/cli/programmatic-api.d.ts +84 -84
- package/dist/cli/programmatic-api.js +66 -66
- package/dist/cli/validate-command.d.ts +2 -2
- package/dist/cli/validate-command.js +18 -18
- package/dist/components/oc-client/_package/package.json +1 -1
- package/dist/components/oc-client/_package/server.js +1 -1
- package/dist/components/oc-client/_package/src/oc-client.min.js +2 -2
- package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
- package/dist/components/oc-client/_package/template.js +11 -1
- package/dist/components/oc-client/package.json +1 -1
- package/dist/components/oc-client/src/oc-client.min.js +2 -2
- package/dist/components/oc-client/src/oc-client.min.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -12
- package/dist/oc-cli.d.ts +2 -2
- package/dist/oc-cli.js +3 -3
- package/dist/registry/app-start.d.ts +3 -3
- package/dist/registry/app-start.js +44 -44
- package/dist/registry/domain/authentication.d.ts +7 -7
- package/dist/registry/domain/authentication.js +53 -53
- package/dist/registry/domain/components-cache/components-list.d.ts +8 -8
- package/dist/registry/domain/components-cache/components-list.js +73 -73
- package/dist/registry/domain/components-cache/index.d.ts +7 -7
- package/dist/registry/domain/components-cache/index.js +81 -81
- package/dist/registry/domain/components-details.d.ts +6 -6
- package/dist/registry/domain/components-details.js +63 -63
- package/dist/registry/domain/events-handler.d.ts +48 -40
- package/dist/registry/domain/events-handler.js +37 -37
- package/dist/registry/domain/extract-package.d.ts +8 -8
- package/dist/registry/domain/extract-package.js +30 -30
- package/dist/registry/domain/get-package-json-from-temp-dir.d.ts +2 -2
- package/dist/registry/domain/get-package-json-from-temp-dir.js +11 -11
- package/dist/registry/domain/nested-renderer.d.ts +14 -14
- package/dist/registry/domain/nested-renderer.js +59 -59
- package/dist/registry/domain/options-sanitiser.d.ts +6 -6
- package/dist/registry/domain/options-sanitiser.js +113 -113
- package/dist/registry/domain/plugins-initialiser.d.ts +3 -3
- package/dist/registry/domain/plugins-initialiser.js +95 -95
- package/dist/registry/domain/register-templates.d.ts +5 -5
- package/dist/registry/domain/register-templates.js +37 -37
- package/dist/registry/domain/repository.d.ts +26 -26
- package/dist/registry/domain/repository.js +255 -255
- package/dist/registry/domain/require-wrapper.d.ts +2 -2
- package/dist/registry/domain/require-wrapper.js +33 -33
- package/dist/registry/domain/sanitiser.d.ts +2 -2
- package/dist/registry/domain/sanitiser.js +52 -52
- package/dist/registry/domain/storage-adapter.d.ts +10 -10
- package/dist/registry/domain/storage-adapter.js +55 -55
- package/dist/registry/domain/url-builder.d.ts +10 -10
- package/dist/registry/domain/url-builder.js +60 -60
- package/dist/registry/domain/validators/component-parameters.d.ts +11 -11
- package/dist/registry/domain/validators/component-parameters.js +79 -79
- package/dist/registry/domain/validators/index.d.ts +16 -16
- package/dist/registry/domain/validators/index.js +29 -29
- package/dist/registry/domain/validators/node-version.d.ts +15 -15
- package/dist/registry/domain/validators/node-version.js +40 -40
- package/dist/registry/domain/validators/oc-cli-version.d.ts +15 -15
- package/dist/registry/domain/validators/oc-cli-version.js +34 -34
- package/dist/registry/domain/validators/package-json-validator.d.ts +13 -13
- package/dist/registry/domain/validators/package-json-validator.js +23 -23
- package/dist/registry/domain/validators/plugins-requirements.d.ts +9 -9
- package/dist/registry/domain/validators/plugins-requirements.js +22 -22
- package/dist/registry/domain/validators/registry-configuration.d.ts +9 -9
- package/dist/registry/domain/validators/registry-configuration.js +117 -117
- package/dist/registry/domain/validators/uploaded-package.d.ts +14 -14
- package/dist/registry/domain/validators/uploaded-package.js +25 -25
- package/dist/registry/domain/version-handler.d.ts +2 -2
- package/dist/registry/domain/version-handler.js +22 -22
- package/dist/registry/index.d.ts +64 -48
- package/dist/registry/index.js +109 -109
- package/dist/registry/middleware/base-url-handler.d.ts +2 -2
- package/dist/registry/middleware/base-url-handler.js +12 -12
- package/dist/registry/middleware/cors.d.ts +2 -2
- package/dist/registry/middleware/cors.js +11 -11
- package/dist/registry/middleware/discovery-handler.d.ts +2 -2
- package/dist/registry/middleware/discovery-handler.js +15 -15
- package/dist/registry/middleware/file-uploads.d.ts +2 -2
- package/dist/registry/middleware/file-uploads.js +23 -23
- package/dist/registry/middleware/index.d.ts +3 -3
- package/dist/registry/middleware/index.js +48 -48
- package/dist/registry/middleware/request-handler.d.ts +2 -2
- package/dist/registry/middleware/request-handler.js +30 -30
- package/dist/registry/router.d.ts +4 -4
- package/dist/registry/router.js +56 -56
- package/dist/registry/routes/component-info.d.ts +4 -4
- package/dist/registry/routes/component-info.js +95 -94
- package/dist/registry/routes/component-preview.d.ts +4 -4
- package/dist/registry/routes/component-preview.js +72 -72
- package/dist/registry/routes/component.d.ts +4 -4
- package/dist/registry/routes/component.js +43 -43
- package/dist/registry/routes/components.d.ts +4 -4
- package/dist/registry/routes/components.js +78 -78
- package/dist/registry/routes/dependencies.d.ts +3 -3
- package/dist/registry/routes/dependencies.js +28 -28
- package/dist/registry/routes/helpers/apply-default-values.d.ts +2 -2
- package/dist/registry/routes/helpers/apply-default-values.js +13 -13
- package/dist/registry/routes/helpers/get-available-dependencies.d.ts +8 -8
- package/dist/registry/routes/helpers/get-available-dependencies.js +23 -23
- package/dist/registry/routes/helpers/get-component-fallback.d.ts +17 -17
- package/dist/registry/routes/helpers/get-component-fallback.js +95 -95
- package/dist/registry/routes/helpers/get-component-retrieving-info.d.ts +20 -20
- package/dist/registry/routes/helpers/get-component-retrieving-info.js +24 -24
- package/dist/registry/routes/helpers/get-component.d.ts +34 -34
- package/dist/registry/routes/helpers/get-component.js +445 -435
- package/dist/registry/routes/helpers/get-components-history.d.ts +8 -8
- package/dist/registry/routes/helpers/get-components-history.js +28 -28
- package/dist/registry/routes/helpers/is-url-discoverable.d.ts +3 -3
- package/dist/registry/routes/helpers/is-url-discoverable.js +21 -21
- package/dist/registry/routes/index.d.ts +3 -3
- package/dist/registry/routes/index.js +93 -93
- package/dist/registry/routes/plugins.d.ts +3 -3
- package/dist/registry/routes/plugins.js +17 -17
- package/dist/registry/routes/publish.d.ts +3 -3
- package/dist/registry/routes/publish.js +101 -101
- package/dist/registry/routes/static-redirector.d.ts +3 -3
- package/dist/registry/routes/static-redirector.js +86 -86
- package/dist/registry/views/index.d.ts +2 -2
- package/dist/registry/views/index.js +39 -39
- package/dist/registry/views/info.d.ts +16 -16
- package/dist/registry/views/info.js +39 -39
- package/dist/registry/views/partials/component-author.d.ts +8 -8
- package/dist/registry/views/partials/component-author.js +20 -20
- package/dist/registry/views/partials/component-parameters.d.ts +5 -5
- package/dist/registry/views/partials/component-parameters.js +24 -24
- package/dist/registry/views/partials/component-state.d.ts +5 -5
- package/dist/registry/views/partials/component-state.js +6 -6
- package/dist/registry/views/partials/component-versions.d.ts +5 -5
- package/dist/registry/views/partials/component-versions.js +9 -9
- package/dist/registry/views/partials/components-dependencies.d.ts +2 -2
- package/dist/registry/views/partials/components-dependencies.js +12 -12
- package/dist/registry/views/partials/components-history.d.ts +2 -2
- package/dist/registry/views/partials/components-history.js +10 -10
- package/dist/registry/views/partials/components-list.d.ts +2 -2
- package/dist/registry/views/partials/components-list.js +26 -26
- package/dist/registry/views/partials/components-plugins.d.ts +2 -2
- package/dist/registry/views/partials/components-plugins.js +8 -8
- package/dist/registry/views/partials/components-templates.d.ts +2 -2
- package/dist/registry/views/partials/components-templates.js +14 -14
- package/dist/registry/views/partials/layout.d.ts +8 -8
- package/dist/registry/views/partials/layout.js +11 -11
- package/dist/registry/views/partials/property.d.ts +2 -2
- package/dist/registry/views/partials/property.js +11 -11
- package/dist/registry/views/partials/selected-checkbox.d.ts +4 -4
- package/dist/registry/views/partials/selected-checkbox.js +7 -7
- package/dist/registry/views/preview.d.ts +8 -8
- package/dist/registry/views/preview.js +9 -9
- package/dist/registry/views/static/index.d.ts +2 -2
- package/dist/registry/views/static/index.js +3 -3
- package/dist/registry/views/static/info.d.ts +2 -2
- package/dist/registry/views/static/info.js +3 -3
- package/dist/registry/views/static/style.d.ts +2 -2
- package/dist/registry/views/static/style.js +3 -3
- package/dist/resources/index.d.ts +134 -134
- package/dist/resources/index.js +145 -145
- package/dist/resources/settings.d.ts +17 -17
- package/dist/resources/settings.js +18 -18
- package/dist/types.d.ts +231 -231
- package/dist/types.js +2 -2
- package/dist/utils/clean-require.d.ts +16 -16
- package/dist/utils/clean-require.js +18 -18
- package/dist/utils/date-stringify.d.ts +1 -1
- package/dist/utils/date-stringify.js +22 -22
- package/dist/utils/error-to-string.d.ts +1 -1
- package/dist/utils/error-to-string.js +15 -15
- package/dist/utils/is-template-legacy.d.ts +3 -3
- package/dist/utils/is-template-legacy.js +6 -6
- package/dist/utils/is-template-valid.d.ts +4 -4
- package/dist/utils/is-template-valid.js +12 -12
- package/dist/utils/module-exists.d.ts +1 -1
- package/dist/utils/module-exists.js +15 -15
- package/dist/utils/npm-utils.d.ts +20 -20
- package/dist/utils/npm-utils.js +74 -74
- package/dist/utils/put.d.ts +2 -2
- package/dist/utils/put.js +29 -29
- package/dist/utils/strip-version.d.ts +1 -1
- package/dist/utils/strip-version.js +11 -11
- package/logintervals.md +1 -1
- package/package.json +20 -20
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
30
|
-
const util_1 = require("util");
|
|
31
|
-
const path_1 = __importDefault(require("path"));
|
|
32
|
-
const require_template_1 = __importDefault(require("./handle-dependencies/require-template"));
|
|
33
|
-
const validator = __importStar(require("../../registry/domain/validators"));
|
|
34
|
-
const packageComponents = () => async (options) => {
|
|
35
|
-
const production = options.production;
|
|
36
|
-
const componentPath = options.componentPath;
|
|
37
|
-
const minify = options.minify === true;
|
|
38
|
-
const verbose = options.verbose === true;
|
|
39
|
-
const publishPath = path_1.default.join(componentPath, '_package');
|
|
40
|
-
const componentPackagePath = path_1.default.join(componentPath, 'package.json');
|
|
41
|
-
const ocPackagePath = path_1.default.join(__dirname, '../../../package.json');
|
|
42
|
-
if (!fs_extra_1.default.existsSync(componentPackagePath)) {
|
|
43
|
-
throw new Error('component does not contain package.json');
|
|
44
|
-
}
|
|
45
|
-
else if (!fs_extra_1.default.existsSync(ocPackagePath)) {
|
|
46
|
-
throw new Error('error resolving oc internal dependencies');
|
|
47
|
-
}
|
|
48
|
-
await fs_extra_1.default.emptyDir(publishPath);
|
|
49
|
-
const componentPackage = await fs_extra_1.default.readJson(componentPackagePath);
|
|
50
|
-
const ocPackage = await fs_extra_1.default.readJson(ocPackagePath);
|
|
51
|
-
if (!validator.validateComponentName(componentPackage.name)) {
|
|
52
|
-
throw new Error('name not valid');
|
|
53
|
-
}
|
|
54
|
-
const type = componentPackage.oc.files.template.type;
|
|
55
|
-
const compileOptions = {
|
|
56
|
-
publishPath,
|
|
57
|
-
componentPath,
|
|
58
|
-
componentPackage,
|
|
59
|
-
ocPackage,
|
|
60
|
-
minify,
|
|
61
|
-
verbose,
|
|
62
|
-
production
|
|
63
|
-
};
|
|
64
|
-
const ocTemplate = (0, require_template_1.default)(type, {
|
|
65
|
-
compiler: true,
|
|
66
|
-
componentPath
|
|
67
|
-
});
|
|
68
|
-
const compile = (0, util_1.promisify)(ocTemplate.compile);
|
|
69
|
-
return compile(compileOptions);
|
|
70
|
-
};
|
|
71
|
-
exports.default = packageComponents;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
30
|
+
const util_1 = require("util");
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const require_template_1 = __importDefault(require("./handle-dependencies/require-template"));
|
|
33
|
+
const validator = __importStar(require("../../registry/domain/validators"));
|
|
34
|
+
const packageComponents = () => async (options) => {
|
|
35
|
+
const production = options.production;
|
|
36
|
+
const componentPath = options.componentPath;
|
|
37
|
+
const minify = options.minify === true;
|
|
38
|
+
const verbose = options.verbose === true;
|
|
39
|
+
const publishPath = path_1.default.join(componentPath, '_package');
|
|
40
|
+
const componentPackagePath = path_1.default.join(componentPath, 'package.json');
|
|
41
|
+
const ocPackagePath = path_1.default.join(__dirname, '../../../package.json');
|
|
42
|
+
if (!fs_extra_1.default.existsSync(componentPackagePath)) {
|
|
43
|
+
throw new Error('component does not contain package.json');
|
|
44
|
+
}
|
|
45
|
+
else if (!fs_extra_1.default.existsSync(ocPackagePath)) {
|
|
46
|
+
throw new Error('error resolving oc internal dependencies');
|
|
47
|
+
}
|
|
48
|
+
await fs_extra_1.default.emptyDir(publishPath);
|
|
49
|
+
const componentPackage = await fs_extra_1.default.readJson(componentPackagePath);
|
|
50
|
+
const ocPackage = await fs_extra_1.default.readJson(ocPackagePath);
|
|
51
|
+
if (!validator.validateComponentName(componentPackage.name)) {
|
|
52
|
+
throw new Error('name not valid');
|
|
53
|
+
}
|
|
54
|
+
const type = componentPackage.oc.files.template.type;
|
|
55
|
+
const compileOptions = {
|
|
56
|
+
publishPath,
|
|
57
|
+
componentPath,
|
|
58
|
+
componentPackage,
|
|
59
|
+
ocPackage,
|
|
60
|
+
minify,
|
|
61
|
+
verbose,
|
|
62
|
+
production
|
|
63
|
+
};
|
|
64
|
+
const ocTemplate = (0, require_template_1.default)(type, {
|
|
65
|
+
compiler: true,
|
|
66
|
+
componentPath
|
|
67
|
+
});
|
|
68
|
+
const compile = (0, util_1.promisify)(ocTemplate.compile);
|
|
69
|
+
return compile(compileOptions);
|
|
70
|
+
};
|
|
71
|
+
exports.default = packageComponents;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { Component } from '../../types';
|
|
3
|
-
interface RegistryOptions {
|
|
4
|
-
registry?: string;
|
|
5
|
-
}
|
|
6
|
-
export default function registry(opts?: RegistryOptions): {
|
|
7
|
-
add(registry: string): Promise<void>;
|
|
8
|
-
get(): Promise<string[]>;
|
|
9
|
-
getApiComponentByHref(href: string): Promise<Component>;
|
|
10
|
-
getComponentPreviewUrlByUrl(componentHref: string): Promise<string>;
|
|
11
|
-
putComponent(options: {
|
|
12
|
-
username?: string;
|
|
13
|
-
password?: string;
|
|
14
|
-
route: string;
|
|
15
|
-
path: string;
|
|
16
|
-
}): Promise<void>;
|
|
17
|
-
remove(registry: string): Promise<void>;
|
|
18
|
-
};
|
|
19
|
-
export type RegistryCli = ReturnType<typeof registry>;
|
|
20
|
-
export {};
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { Component } from '../../types';
|
|
3
|
+
interface RegistryOptions {
|
|
4
|
+
registry?: string;
|
|
5
|
+
}
|
|
6
|
+
export default function registry(opts?: RegistryOptions): {
|
|
7
|
+
add(registry: string): Promise<void>;
|
|
8
|
+
get(): Promise<string[]>;
|
|
9
|
+
getApiComponentByHref(href: string): Promise<Component>;
|
|
10
|
+
getComponentPreviewUrlByUrl(componentHref: string): Promise<string>;
|
|
11
|
+
putComponent(options: {
|
|
12
|
+
username?: string;
|
|
13
|
+
password?: string;
|
|
14
|
+
route: string;
|
|
15
|
+
path: string;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
remove(registry: string): Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export type RegistryCli = ReturnType<typeof registry>;
|
|
20
|
+
export {};
|
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
30
|
-
const path_1 = __importDefault(require("path"));
|
|
31
|
-
const got_1 = __importDefault(require("got"));
|
|
32
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
33
|
-
const put_1 = __importDefault(require("../../utils/put"));
|
|
34
|
-
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
35
|
-
const urlBuilder = __importStar(require("../../registry/domain/url-builder"));
|
|
36
|
-
const urlParser = __importStar(require("../domain/url-parser"));
|
|
37
|
-
const getOcVersion = () => {
|
|
38
|
-
const ocPackagePath = path_1.default.join(__dirname, '../../../package.json');
|
|
39
|
-
const ocInfo = fs_extra_1.default.readJsonSync(ocPackagePath);
|
|
40
|
-
return ocInfo.version;
|
|
41
|
-
};
|
|
42
|
-
function registry(opts = {}) {
|
|
43
|
-
let requestsHeaders = {
|
|
44
|
-
'user-agent': `oc-cli-${getOcVersion()}/${process.version}-${process.platform}-${process.arch}`
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
async add(registry) {
|
|
48
|
-
if (registry.slice(registry.length - 1) !== '/') {
|
|
49
|
-
registry += '/';
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const apiResponse = await (0, got_1.default)(registry, {
|
|
53
|
-
headers: requestsHeaders
|
|
54
|
-
}).json();
|
|
55
|
-
if (!apiResponse)
|
|
56
|
-
throw 'oc registry not available';
|
|
57
|
-
if (apiResponse.type !== 'oc-registry')
|
|
58
|
-
throw 'not a valid oc registry';
|
|
59
|
-
const res = await fs_extra_1.default
|
|
60
|
-
.readJson(settings_1.default.configFile.src)
|
|
61
|
-
.catch(() => ({}));
|
|
62
|
-
if (!res.registries) {
|
|
63
|
-
res.registries = [];
|
|
64
|
-
}
|
|
65
|
-
if (!lodash_1.default.includes(res.registries, registry)) {
|
|
66
|
-
res.registries.push(registry);
|
|
67
|
-
}
|
|
68
|
-
return fs_extra_1.default.writeJson(settings_1.default.configFile.src, res);
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
throw 'oc registry not available';
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
async get() {
|
|
75
|
-
if (opts.registry) {
|
|
76
|
-
return [opts.registry];
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const res = await fs_extra_1.default.readJson(settings_1.default.configFile.src);
|
|
80
|
-
if (!res.registries || res.registries.length === 0)
|
|
81
|
-
throw 'No oc registries';
|
|
82
|
-
return res.registries;
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
throw 'No oc registries';
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
getApiComponentByHref(href) {
|
|
89
|
-
return (0, got_1.default)(href + settings_1.default.registry.componentInfoPath, {
|
|
90
|
-
headers: requestsHeaders
|
|
91
|
-
}).json();
|
|
92
|
-
},
|
|
93
|
-
async getComponentPreviewUrlByUrl(componentHref) {
|
|
94
|
-
const res = await (0, got_1.default)(componentHref, { headers: requestsHeaders }).json();
|
|
95
|
-
const parsed = urlParser.parse(res);
|
|
96
|
-
return urlBuilder.componentPreview(parsed, parsed.registryUrl);
|
|
97
|
-
},
|
|
98
|
-
async putComponent(options) {
|
|
99
|
-
if (!!options.username && !!options.password) {
|
|
100
|
-
requestsHeaders = Object.assign(requestsHeaders, {
|
|
101
|
-
Authorization: 'Basic ' +
|
|
102
|
-
Buffer.from(options.username + ':' + options.password).toString('base64')
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
await (0, put_1.default)(options.route, options.path, requestsHeaders);
|
|
107
|
-
}
|
|
108
|
-
catch (err) {
|
|
109
|
-
let parsedError = err.response.body || err;
|
|
110
|
-
let errMsg = '';
|
|
111
|
-
if (!lodash_1.default.isObject(parsedError)) {
|
|
112
|
-
try {
|
|
113
|
-
parsedError = JSON.parse(String(parsedError));
|
|
114
|
-
}
|
|
115
|
-
catch (er) { }
|
|
116
|
-
}
|
|
117
|
-
if (!!parsedError.code && parsedError.code === 'ECONNREFUSED') {
|
|
118
|
-
errMsg = 'Connection to registry has not been established';
|
|
119
|
-
}
|
|
120
|
-
else if (parsedError.code !== 'cli_version_not_valid' &&
|
|
121
|
-
parsedError.code !== 'node_version_not_valid' &&
|
|
122
|
-
!!parsedError.error) {
|
|
123
|
-
errMsg = parsedError.error;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
errMsg = parsedError;
|
|
127
|
-
}
|
|
128
|
-
throw errMsg;
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
async remove(registry) {
|
|
132
|
-
if (registry.slice(registry.length - 1) !== '/') {
|
|
133
|
-
registry += '/';
|
|
134
|
-
}
|
|
135
|
-
const res = await fs_extra_1.default
|
|
136
|
-
.readJson(settings_1.default.configFile.src)
|
|
137
|
-
.catch(() => ({ registries: [] }));
|
|
138
|
-
res.registries = lodash_1.default.without(res.registries, registry);
|
|
139
|
-
await fs_extra_1.default.writeJson(settings_1.default.configFile.src, res);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
exports.default = registry;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
30
|
+
const path_1 = __importDefault(require("path"));
|
|
31
|
+
const got_1 = __importDefault(require("got"));
|
|
32
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
33
|
+
const put_1 = __importDefault(require("../../utils/put"));
|
|
34
|
+
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
35
|
+
const urlBuilder = __importStar(require("../../registry/domain/url-builder"));
|
|
36
|
+
const urlParser = __importStar(require("../domain/url-parser"));
|
|
37
|
+
const getOcVersion = () => {
|
|
38
|
+
const ocPackagePath = path_1.default.join(__dirname, '../../../package.json');
|
|
39
|
+
const ocInfo = fs_extra_1.default.readJsonSync(ocPackagePath);
|
|
40
|
+
return ocInfo.version;
|
|
41
|
+
};
|
|
42
|
+
function registry(opts = {}) {
|
|
43
|
+
let requestsHeaders = {
|
|
44
|
+
'user-agent': `oc-cli-${getOcVersion()}/${process.version}-${process.platform}-${process.arch}`
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
async add(registry) {
|
|
48
|
+
if (registry.slice(registry.length - 1) !== '/') {
|
|
49
|
+
registry += '/';
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const apiResponse = await (0, got_1.default)(registry, {
|
|
53
|
+
headers: requestsHeaders
|
|
54
|
+
}).json();
|
|
55
|
+
if (!apiResponse)
|
|
56
|
+
throw 'oc registry not available';
|
|
57
|
+
if (apiResponse.type !== 'oc-registry')
|
|
58
|
+
throw 'not a valid oc registry';
|
|
59
|
+
const res = await fs_extra_1.default
|
|
60
|
+
.readJson(settings_1.default.configFile.src)
|
|
61
|
+
.catch(() => ({}));
|
|
62
|
+
if (!res.registries) {
|
|
63
|
+
res.registries = [];
|
|
64
|
+
}
|
|
65
|
+
if (!lodash_1.default.includes(res.registries, registry)) {
|
|
66
|
+
res.registries.push(registry);
|
|
67
|
+
}
|
|
68
|
+
return fs_extra_1.default.writeJson(settings_1.default.configFile.src, res);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
throw 'oc registry not available';
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
async get() {
|
|
75
|
+
if (opts.registry) {
|
|
76
|
+
return [opts.registry];
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const res = await fs_extra_1.default.readJson(settings_1.default.configFile.src);
|
|
80
|
+
if (!res.registries || res.registries.length === 0)
|
|
81
|
+
throw 'No oc registries';
|
|
82
|
+
return res.registries;
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
throw 'No oc registries';
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
getApiComponentByHref(href) {
|
|
89
|
+
return (0, got_1.default)(href + settings_1.default.registry.componentInfoPath, {
|
|
90
|
+
headers: requestsHeaders
|
|
91
|
+
}).json();
|
|
92
|
+
},
|
|
93
|
+
async getComponentPreviewUrlByUrl(componentHref) {
|
|
94
|
+
const res = await (0, got_1.default)(componentHref, { headers: requestsHeaders }).json();
|
|
95
|
+
const parsed = urlParser.parse(res);
|
|
96
|
+
return urlBuilder.componentPreview(parsed, parsed.registryUrl);
|
|
97
|
+
},
|
|
98
|
+
async putComponent(options) {
|
|
99
|
+
if (!!options.username && !!options.password) {
|
|
100
|
+
requestsHeaders = Object.assign(requestsHeaders, {
|
|
101
|
+
Authorization: 'Basic ' +
|
|
102
|
+
Buffer.from(options.username + ':' + options.password).toString('base64')
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
await (0, put_1.default)(options.route, options.path, requestsHeaders);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
let parsedError = err.response.body || err;
|
|
110
|
+
let errMsg = '';
|
|
111
|
+
if (!lodash_1.default.isObject(parsedError)) {
|
|
112
|
+
try {
|
|
113
|
+
parsedError = JSON.parse(String(parsedError));
|
|
114
|
+
}
|
|
115
|
+
catch (er) { }
|
|
116
|
+
}
|
|
117
|
+
if (!!parsedError.code && parsedError.code === 'ECONNREFUSED') {
|
|
118
|
+
errMsg = 'Connection to registry has not been established';
|
|
119
|
+
}
|
|
120
|
+
else if (parsedError.code !== 'cli_version_not_valid' &&
|
|
121
|
+
parsedError.code !== 'node_version_not_valid' &&
|
|
122
|
+
!!parsedError.error) {
|
|
123
|
+
errMsg = parsedError.error;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
errMsg = parsedError;
|
|
127
|
+
}
|
|
128
|
+
throw errMsg;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
async remove(registry) {
|
|
132
|
+
if (registry.slice(registry.length - 1) !== '/') {
|
|
133
|
+
registry += '/';
|
|
134
|
+
}
|
|
135
|
+
const res = await fs_extra_1.default
|
|
136
|
+
.readJson(settings_1.default.configFile.src)
|
|
137
|
+
.catch(() => ({ registries: [] }));
|
|
138
|
+
res.registries = lodash_1.default.without(res.registries, registry);
|
|
139
|
+
await fs_extra_1.default.writeJson(settings_1.default.configFile.src, res);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
exports.default = registry;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import querystring from 'querystring';
|
|
3
|
-
interface UrlParsed {
|
|
4
|
-
clientHref: string;
|
|
5
|
-
name: string;
|
|
6
|
-
parameters: querystring.ParsedUrlQuery;
|
|
7
|
-
registryUrl: string;
|
|
8
|
-
version: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function parse(parsed: {
|
|
11
|
-
requestVersion: string;
|
|
12
|
-
href: string;
|
|
13
|
-
}): UrlParsed;
|
|
14
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import querystring from 'querystring';
|
|
3
|
+
interface UrlParsed {
|
|
4
|
+
clientHref: string;
|
|
5
|
+
name: string;
|
|
6
|
+
parameters: querystring.ParsedUrlQuery;
|
|
7
|
+
registryUrl: string;
|
|
8
|
+
version: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function parse(parsed: {
|
|
11
|
+
requestVersion: string;
|
|
12
|
+
href: string;
|
|
13
|
+
}): UrlParsed;
|
|
14
|
+
export {};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parse = void 0;
|
|
7
|
-
const querystring_1 = __importDefault(require("querystring"));
|
|
8
|
-
const url_1 = __importDefault(require("url"));
|
|
9
|
-
const removeFinalSlashes = function (s) {
|
|
10
|
-
while (s.slice(-1) === '/') {
|
|
11
|
-
s = s.slice(0, -1);
|
|
12
|
-
}
|
|
13
|
-
return s;
|
|
14
|
-
};
|
|
15
|
-
function parse(parsed) {
|
|
16
|
-
const requestedVersion = parsed.requestVersion;
|
|
17
|
-
const href = url_1.default.parse(parsed.href);
|
|
18
|
-
const relativePath = removeFinalSlashes(href.pathname || '');
|
|
19
|
-
const withoutVersion = removeFinalSlashes(relativePath.replace(requestedVersion, ''));
|
|
20
|
-
const componentName = withoutVersion.substr(withoutVersion.lastIndexOf('/') + 1);
|
|
21
|
-
const withoutComponent = removeFinalSlashes(withoutVersion.replace(componentName, ''));
|
|
22
|
-
const registryUrl = href.protocol + '//' + href.host + withoutComponent + '/';
|
|
23
|
-
return {
|
|
24
|
-
clientHref: registryUrl + 'oc-client/client.js',
|
|
25
|
-
name: componentName,
|
|
26
|
-
parameters: querystring_1.default.parse(href.query || ''),
|
|
27
|
-
registryUrl: registryUrl,
|
|
28
|
-
version: requestedVersion
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.parse = parse;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parse = void 0;
|
|
7
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
8
|
+
const url_1 = __importDefault(require("url"));
|
|
9
|
+
const removeFinalSlashes = function (s) {
|
|
10
|
+
while (s.slice(-1) === '/') {
|
|
11
|
+
s = s.slice(0, -1);
|
|
12
|
+
}
|
|
13
|
+
return s;
|
|
14
|
+
};
|
|
15
|
+
function parse(parsed) {
|
|
16
|
+
const requestedVersion = parsed.requestVersion;
|
|
17
|
+
const href = url_1.default.parse(parsed.href);
|
|
18
|
+
const relativePath = removeFinalSlashes(href.pathname || '');
|
|
19
|
+
const withoutVersion = removeFinalSlashes(relativePath.replace(requestedVersion, ''));
|
|
20
|
+
const componentName = withoutVersion.substr(withoutVersion.lastIndexOf('/') + 1);
|
|
21
|
+
const withoutComponent = removeFinalSlashes(withoutVersion.replace(componentName, ''));
|
|
22
|
+
const registryUrl = href.protocol + '//' + href.host + withoutComponent + '/';
|
|
23
|
+
return {
|
|
24
|
+
clientHref: registryUrl + 'oc-client/client.js',
|
|
25
|
+
name: componentName,
|
|
26
|
+
parameters: querystring_1.default.parse(href.query || ''),
|
|
27
|
+
registryUrl: registryUrl,
|
|
28
|
+
version: requestedVersion
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.parse = parse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function watch(dirs: string[], baseDir: string, changed: (err: Error | null, fileName: string, componentDir?: string) => void): void;
|
|
1
|
+
export default function watch(dirs: string[], baseDir: string, changed: (err: Error | null, fileName: string, componentDir?: string) => void): void;
|
package/dist/cli/domain/watch.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
-
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
9
|
-
function watch(dirs, baseDir, changed) {
|
|
10
|
-
const watcher = chokidar_1.default.watch(path_1.default.resolve(baseDir), {
|
|
11
|
-
ignored: settings_1.default.filesToIgnoreOnDevWatch,
|
|
12
|
-
persistent: true,
|
|
13
|
-
ignoreInitial: true,
|
|
14
|
-
usePolling: true
|
|
15
|
-
});
|
|
16
|
-
const onChange = (fileName) => {
|
|
17
|
-
const componentDir = dirs.find(dir => Boolean(fileName.match(escapeRegularExpression(dir + path_1.default.sep))));
|
|
18
|
-
changed(null, fileName, componentDir);
|
|
19
|
-
};
|
|
20
|
-
watcher
|
|
21
|
-
.on('add', onChange)
|
|
22
|
-
.on('change', onChange)
|
|
23
|
-
.on('unlink', onChange)
|
|
24
|
-
.on('error', changed);
|
|
25
|
-
}
|
|
26
|
-
exports.default = watch;
|
|
27
|
-
function escapeRegularExpression(text) {
|
|
28
|
-
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
29
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
+
const settings_1 = __importDefault(require("../../resources/settings"));
|
|
9
|
+
function watch(dirs, baseDir, changed) {
|
|
10
|
+
const watcher = chokidar_1.default.watch(path_1.default.resolve(baseDir), {
|
|
11
|
+
ignored: settings_1.default.filesToIgnoreOnDevWatch,
|
|
12
|
+
persistent: true,
|
|
13
|
+
ignoreInitial: true,
|
|
14
|
+
usePolling: true
|
|
15
|
+
});
|
|
16
|
+
const onChange = (fileName) => {
|
|
17
|
+
const componentDir = dirs.find(dir => Boolean(fileName.match(escapeRegularExpression(dir + path_1.default.sep))));
|
|
18
|
+
changed(null, fileName, componentDir);
|
|
19
|
+
};
|
|
20
|
+
watcher
|
|
21
|
+
.on('add', onChange)
|
|
22
|
+
.on('change', onChange)
|
|
23
|
+
.on('unlink', onChange)
|
|
24
|
+
.on('error', changed);
|
|
25
|
+
}
|
|
26
|
+
exports.default = watch;
|
|
27
|
+
function escapeRegularExpression(text) {
|
|
28
|
+
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
29
|
+
}
|