@vendure/ui-devkit 2.2.0-next.3 → 2.2.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/compiler/types.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=types.js.map
@@ -1,34 +1,34 @@
1
- import { AdminUiExtension, AdminUiExtensionWithId, Extension, GlobalStylesExtension, SassVariableOverridesExtension, StaticAssetDefinition, StaticAssetExtension, TranslationExtension } from './types';
2
- export declare const logger: {
3
- log: (message: string) => void;
4
- error: (message: string) => void;
5
- };
6
- /**
7
- * Checks for the global yarn binary and returns true if found.
8
- */
9
- export declare function shouldUseYarn(): boolean;
10
- /**
11
- * Returns the string path of a static asset
12
- */
13
- export declare function getStaticAssetPath(staticAssetDef: StaticAssetDefinition): string;
14
- /**
15
- * Copy the @vendure/ui-devkit files to the static assets dir.
16
- */
17
- export declare function copyUiDevkit(outputPath: string): void;
18
- /**
19
- * Copies over any files defined by the extensions' `staticAssets` array to the shared
20
- * static assets directory. When the app is built by the ng cli, this assets directory is
21
- * the copied over to the final static assets location (i.e. http://domain/admin/assets/)
22
- */
23
- export declare function copyStaticAsset(outputPath: string, staticAssetDef: StaticAssetDefinition): Promise<void>;
24
- /**
25
- * Ensures each extension has an ID and a value for the optional properties.
26
- * If not defined by the user, a deterministic ID is generated
27
- * from a hash of the extension config.
28
- */
29
- export declare function normalizeExtensions(extensions?: AdminUiExtension[]): AdminUiExtensionWithId[];
30
- export declare function isAdminUiExtension(input: Extension): input is AdminUiExtension;
31
- export declare function isTranslationExtension(input: Extension): input is TranslationExtension;
32
- export declare function isStaticAssetExtension(input: Extension): input is StaticAssetExtension;
33
- export declare function isGlobalStylesExtension(input: Extension): input is GlobalStylesExtension;
34
- export declare function isSassVariableOverridesExtension(input: Extension): input is SassVariableOverridesExtension;
1
+ import { AdminUiExtension, AdminUiExtensionWithId, Extension, GlobalStylesExtension, SassVariableOverridesExtension, StaticAssetDefinition, StaticAssetExtension, TranslationExtension } from './types';
2
+ export declare const logger: {
3
+ log: (message: string) => void;
4
+ error: (message: string) => void;
5
+ };
6
+ /**
7
+ * Checks for the global yarn binary and returns true if found.
8
+ */
9
+ export declare function shouldUseYarn(): boolean;
10
+ /**
11
+ * Returns the string path of a static asset
12
+ */
13
+ export declare function getStaticAssetPath(staticAssetDef: StaticAssetDefinition): string;
14
+ /**
15
+ * Copy the @vendure/ui-devkit files to the static assets dir.
16
+ */
17
+ export declare function copyUiDevkit(outputPath: string): void;
18
+ /**
19
+ * Copies over any files defined by the extensions' `staticAssets` array to the shared
20
+ * static assets directory. When the app is built by the ng cli, this assets directory is
21
+ * the copied over to the final static assets location (i.e. http://domain/admin/assets/)
22
+ */
23
+ export declare function copyStaticAsset(outputPath: string, staticAssetDef: StaticAssetDefinition): Promise<void>;
24
+ /**
25
+ * Ensures each extension has an ID and a value for the optional properties.
26
+ * If not defined by the user, a deterministic ID is generated
27
+ * from a hash of the extension config.
28
+ */
29
+ export declare function normalizeExtensions(extensions?: AdminUiExtension[]): AdminUiExtensionWithId[];
30
+ export declare function isAdminUiExtension(input: Extension): input is AdminUiExtension;
31
+ export declare function isTranslationExtension(input: Extension): input is TranslationExtension;
32
+ export declare function isStaticAssetExtension(input: Extension): input is StaticAssetExtension;
33
+ export declare function isGlobalStylesExtension(input: Extension): input is GlobalStylesExtension;
34
+ export declare function isSassVariableOverridesExtension(input: Extension): input is SassVariableOverridesExtension;
package/compiler/utils.js CHANGED
@@ -1,138 +1,138 @@
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
- exports.isSassVariableOverridesExtension = exports.isGlobalStylesExtension = exports.isStaticAssetExtension = exports.isTranslationExtension = exports.isAdminUiExtension = exports.normalizeExtensions = exports.copyStaticAsset = exports.copyUiDevkit = exports.getStaticAssetPath = exports.shouldUseYarn = exports.logger = void 0;
30
- /* eslint-disable no-console */
31
- const chalk_1 = __importDefault(require("chalk"));
32
- const child_process_1 = require("child_process");
33
- const crypto_1 = require("crypto");
34
- const fs = __importStar(require("fs-extra"));
35
- const path = __importStar(require("path"));
36
- const constants_1 = require("./constants");
37
- exports.logger = {
38
- log: (message) => console.log(chalk_1.default.green(message)),
39
- error: (message) => console.log(chalk_1.default.red(message)),
40
- };
41
- /**
42
- * Checks for the global yarn binary and returns true if found.
43
- */
44
- function shouldUseYarn() {
45
- try {
46
- (0, child_process_1.execSync)('yarnpkg --version', { stdio: 'ignore' });
47
- return true;
48
- }
49
- catch (e) {
50
- return false;
51
- }
52
- }
53
- exports.shouldUseYarn = shouldUseYarn;
54
- /**
55
- * Returns the string path of a static asset
56
- */
57
- function getStaticAssetPath(staticAssetDef) {
58
- return typeof staticAssetDef === 'string' ? staticAssetDef : staticAssetDef.path;
59
- }
60
- exports.getStaticAssetPath = getStaticAssetPath;
61
- /**
62
- * Copy the @vendure/ui-devkit files to the static assets dir.
63
- */
64
- function copyUiDevkit(outputPath) {
65
- const devkitDir = path.join(outputPath, constants_1.STATIC_ASSETS_OUTPUT_DIR, 'devkit');
66
- fs.ensureDirSync(devkitDir);
67
- fs.copySync(require.resolve('@vendure/ui-devkit'), path.join(devkitDir, 'ui-devkit.js'));
68
- }
69
- exports.copyUiDevkit = copyUiDevkit;
70
- /**
71
- * Copies over any files defined by the extensions' `staticAssets` array to the shared
72
- * static assets directory. When the app is built by the ng cli, this assets directory is
73
- * the copied over to the final static assets location (i.e. http://domain/admin/assets/)
74
- */
75
- async function copyStaticAsset(outputPath, staticAssetDef) {
76
- const staticAssetPath = getStaticAssetPath(staticAssetDef);
77
- const assetBasename = path.basename(staticAssetPath);
78
- const assetOutputPath = path.join(outputPath, constants_1.STATIC_ASSETS_OUTPUT_DIR, assetBasename);
79
- fs.copySync(staticAssetPath, assetOutputPath);
80
- if (typeof staticAssetDef !== 'string') {
81
- // The asset is being renamed
82
- const newName = path.join(path.dirname(assetOutputPath), staticAssetDef.rename);
83
- try {
84
- // We use copy, remove rather than rename due to problems with the
85
- // EPERM error in Windows.
86
- await fs.copy(assetOutputPath, newName);
87
- await fs.remove(assetOutputPath);
88
- }
89
- catch (e) {
90
- exports.logger.log(e);
91
- }
92
- }
93
- }
94
- exports.copyStaticAsset = copyStaticAsset;
95
- /**
96
- * Ensures each extension has an ID and a value for the optional properties.
97
- * If not defined by the user, a deterministic ID is generated
98
- * from a hash of the extension config.
99
- */
100
- function normalizeExtensions(extensions) {
101
- return (extensions || []).map(e => {
102
- let id = e.id;
103
- if (!id) {
104
- const hash = (0, crypto_1.createHash)('sha256');
105
- hash.update(JSON.stringify(e));
106
- id = hash.digest('hex');
107
- }
108
- return {
109
- staticAssets: [],
110
- translations: {},
111
- globalStyles: [],
112
- ...e,
113
- id,
114
- };
115
- });
116
- }
117
- exports.normalizeExtensions = normalizeExtensions;
118
- function isAdminUiExtension(input) {
119
- return input.hasOwnProperty('extensionPath');
120
- }
121
- exports.isAdminUiExtension = isAdminUiExtension;
122
- function isTranslationExtension(input) {
123
- return input.hasOwnProperty('translations');
124
- }
125
- exports.isTranslationExtension = isTranslationExtension;
126
- function isStaticAssetExtension(input) {
127
- return input.hasOwnProperty('staticAssets');
128
- }
129
- exports.isStaticAssetExtension = isStaticAssetExtension;
130
- function isGlobalStylesExtension(input) {
131
- return input.hasOwnProperty('globalStyles');
132
- }
133
- exports.isGlobalStylesExtension = isGlobalStylesExtension;
134
- function isSassVariableOverridesExtension(input) {
135
- return input.hasOwnProperty('sassVariableOverrides');
136
- }
137
- exports.isSassVariableOverridesExtension = isSassVariableOverridesExtension;
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
+ exports.isSassVariableOverridesExtension = exports.isGlobalStylesExtension = exports.isStaticAssetExtension = exports.isTranslationExtension = exports.isAdminUiExtension = exports.normalizeExtensions = exports.copyStaticAsset = exports.copyUiDevkit = exports.getStaticAssetPath = exports.shouldUseYarn = exports.logger = void 0;
30
+ /* eslint-disable no-console */
31
+ const chalk_1 = __importDefault(require("chalk"));
32
+ const child_process_1 = require("child_process");
33
+ const crypto_1 = require("crypto");
34
+ const fs = __importStar(require("fs-extra"));
35
+ const path = __importStar(require("path"));
36
+ const constants_1 = require("./constants");
37
+ exports.logger = {
38
+ log: (message) => console.log(chalk_1.default.green(message)),
39
+ error: (message) => console.log(chalk_1.default.red(message)),
40
+ };
41
+ /**
42
+ * Checks for the global yarn binary and returns true if found.
43
+ */
44
+ function shouldUseYarn() {
45
+ try {
46
+ (0, child_process_1.execSync)('yarnpkg --version', { stdio: 'ignore' });
47
+ return true;
48
+ }
49
+ catch (e) {
50
+ return false;
51
+ }
52
+ }
53
+ exports.shouldUseYarn = shouldUseYarn;
54
+ /**
55
+ * Returns the string path of a static asset
56
+ */
57
+ function getStaticAssetPath(staticAssetDef) {
58
+ return typeof staticAssetDef === 'string' ? staticAssetDef : staticAssetDef.path;
59
+ }
60
+ exports.getStaticAssetPath = getStaticAssetPath;
61
+ /**
62
+ * Copy the @vendure/ui-devkit files to the static assets dir.
63
+ */
64
+ function copyUiDevkit(outputPath) {
65
+ const devkitDir = path.join(outputPath, constants_1.STATIC_ASSETS_OUTPUT_DIR, 'devkit');
66
+ fs.ensureDirSync(devkitDir);
67
+ fs.copySync(require.resolve('@vendure/ui-devkit'), path.join(devkitDir, 'ui-devkit.js'));
68
+ }
69
+ exports.copyUiDevkit = copyUiDevkit;
70
+ /**
71
+ * Copies over any files defined by the extensions' `staticAssets` array to the shared
72
+ * static assets directory. When the app is built by the ng cli, this assets directory is
73
+ * the copied over to the final static assets location (i.e. http://domain/admin/assets/)
74
+ */
75
+ async function copyStaticAsset(outputPath, staticAssetDef) {
76
+ const staticAssetPath = getStaticAssetPath(staticAssetDef);
77
+ const assetBasename = path.basename(staticAssetPath);
78
+ const assetOutputPath = path.join(outputPath, constants_1.STATIC_ASSETS_OUTPUT_DIR, assetBasename);
79
+ fs.copySync(staticAssetPath, assetOutputPath);
80
+ if (typeof staticAssetDef !== 'string') {
81
+ // The asset is being renamed
82
+ const newName = path.join(path.dirname(assetOutputPath), staticAssetDef.rename);
83
+ try {
84
+ // We use copy, remove rather than rename due to problems with the
85
+ // EPERM error in Windows.
86
+ await fs.copy(assetOutputPath, newName);
87
+ await fs.remove(assetOutputPath);
88
+ }
89
+ catch (e) {
90
+ exports.logger.log(e);
91
+ }
92
+ }
93
+ }
94
+ exports.copyStaticAsset = copyStaticAsset;
95
+ /**
96
+ * Ensures each extension has an ID and a value for the optional properties.
97
+ * If not defined by the user, a deterministic ID is generated
98
+ * from a hash of the extension config.
99
+ */
100
+ function normalizeExtensions(extensions) {
101
+ return (extensions || []).map(e => {
102
+ let id = e.id;
103
+ if (!id) {
104
+ const hash = (0, crypto_1.createHash)('sha256');
105
+ hash.update(JSON.stringify(e));
106
+ id = hash.digest('hex');
107
+ }
108
+ return {
109
+ staticAssets: [],
110
+ translations: {},
111
+ globalStyles: [],
112
+ ...e,
113
+ id,
114
+ };
115
+ });
116
+ }
117
+ exports.normalizeExtensions = normalizeExtensions;
118
+ function isAdminUiExtension(input) {
119
+ return input.hasOwnProperty('extensionPath');
120
+ }
121
+ exports.isAdminUiExtension = isAdminUiExtension;
122
+ function isTranslationExtension(input) {
123
+ return input.hasOwnProperty('translations');
124
+ }
125
+ exports.isTranslationExtension = isTranslationExtension;
126
+ function isStaticAssetExtension(input) {
127
+ return input.hasOwnProperty('staticAssets');
128
+ }
129
+ exports.isStaticAssetExtension = isStaticAssetExtension;
130
+ function isGlobalStylesExtension(input) {
131
+ return input.hasOwnProperty('globalStyles');
132
+ }
133
+ exports.isGlobalStylesExtension = isGlobalStylesExtension;
134
+ function isSassVariableOverridesExtension(input) {
135
+ return input.hasOwnProperty('sassVariableOverrides');
136
+ }
137
+ exports.isSassVariableOverridesExtension = isSassVariableOverridesExtension;
138
138
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendure/ui-devkit",
3
- "version": "2.2.0-next.3",
3
+ "version": "2.2.0-next.4",
4
4
  "description": "A library for authoring Vendure Admin UI extensions",
5
5
  "keywords": [
6
6
  "vendure",
@@ -40,8 +40,8 @@
40
40
  "@angular/cli": "^16.2.0",
41
41
  "@angular/compiler": "^16.2.2",
42
42
  "@angular/compiler-cli": "^16.2.2",
43
- "@vendure/admin-ui": "2.2.0-next.3",
44
- "@vendure/common": "2.2.0-next.3",
43
+ "@vendure/admin-ui": "2.2.0-next.4",
44
+ "@vendure/common": "2.2.0-next.4",
45
45
  "chalk": "^4.1.0",
46
46
  "chokidar": "^3.5.3",
47
47
  "fs-extra": "^11.1.1",
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@rollup/plugin-node-resolve": "^15.2.1",
53
53
  "@types/fs-extra": "^11.0.1",
54
- "@vendure/core": "2.2.0-next.3",
54
+ "@vendure/core": "2.2.0-next.4",
55
55
  "react": "^18.2.0",
56
56
  "react-dom": "^18.2.0",
57
57
  "rimraf": "^3.0.2",
@@ -59,7 +59,7 @@
59
59
  "rollup-plugin-terser": "^7.0.2",
60
60
  "rollup-plugin-typescript2": "^0.35.0",
61
61
  "tslib": "^2.6.2",
62
- "typescript": "4.9.5"
62
+ "typescript": "5.1.6"
63
63
  },
64
- "gitHead": "28f529c4b3328150021c19cc1363d4b9a56e928c"
64
+ "gitHead": "bec677ca0eaaaeea453c8b78cab143c95dece174"
65
65
  }