@hubspot/ui-extensions-dev-server 0.10.0 → 0.10.2

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/dist/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.DevModeUnifiedInterfaceNonSingleton = exports.DevModeUnifiedInterface = exports.DevModeInterfaceNonSingleton = exports.DevModeInterface = exports.buildSingleExtension = exports.remoteBuild = void 0;
27
37
  const build_1 = require("./lib/build");
@@ -67,9 +67,9 @@ class DevModeParentInterface {
67
67
  this.isConfigured = false;
68
68
  this.isRunning = false;
69
69
  }
70
- parentSetup({ onUploadRequired, logger, urls, setActiveApp, choices = [], }) {
71
- var _a, _b, _c;
72
- return __awaiter(this, void 0, void 0, function* () {
70
+ parentSetup(_a) {
71
+ return __awaiter(this, arguments, void 0, function* ({ onUploadRequired, logger, urls, setActiveApp, choices = [], }) {
72
+ var _b, _c, _d;
73
73
  if (this.isConfigured) {
74
74
  logger.debug('Dev server has already been configured, skipping');
75
75
  return;
@@ -105,13 +105,13 @@ class DevModeParentInterface {
105
105
  }
106
106
  this.isConfigured = true;
107
107
  if (typeof setActiveApp === 'function') {
108
- yield setActiveApp((_c = (_b = (_a = this.configs) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.appConfig) === null || _c === void 0 ? void 0 : _c.uid);
108
+ yield setActiveApp((_d = (_c = (_b = this.configs) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.appConfig) === null || _d === void 0 ? void 0 : _d.uid);
109
109
  }
110
110
  });
111
111
  }
112
- start({ requestPorts, accountId, projectConfig, }) {
113
- var _a, _b, _c, _d;
114
- return __awaiter(this, void 0, void 0, function* () {
112
+ start(_a) {
113
+ return __awaiter(this, arguments, void 0, function* ({ requestPorts, accountId, projectConfig, }) {
114
+ var _b, _c, _d, _e;
115
115
  this.logger.debug('Start function was invoked', {
116
116
  accountId,
117
117
  projectConfig,
@@ -138,7 +138,7 @@ class DevModeParentInterface {
138
138
  this.logger.debug('Call to port manager failed, using default ports');
139
139
  }
140
140
  }
141
- const { proxy: localDevUrlMapping } = (0, config_1.loadLocalConfig)(((_b = (_a = this.configs) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.path) || '', this.logger) || {};
141
+ const { proxy: localDevUrlMapping } = (0, config_1.loadLocalConfig)(((_c = (_b = this.configs) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.path) || '', this.logger) || {};
142
142
  try {
143
143
  this.devServerState = new DevServerState_1.DevServerState({
144
144
  localDevUrlMapping,
@@ -149,7 +149,7 @@ class DevModeParentInterface {
149
149
  webSocketPort,
150
150
  logger: this.logger,
151
151
  urls: this.urls,
152
- appConfig: (_d = (_c = this.configs) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.appConfig,
152
+ appConfig: (_e = (_d = this.configs) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.appConfig,
153
153
  });
154
154
  }
155
155
  catch (e) {
@@ -128,8 +128,8 @@ class DevModeUnifiedInterface extends DevModeParentInterface_1.DevModeParentInte
128
128
  return mappings;
129
129
  }
130
130
  setup(args) {
131
- var _a;
132
131
  return __awaiter(this, void 0, void 0, function* () {
132
+ var _a;
133
133
  args.choices = this._generateAppExtensionMappings(args.components, (_a = args.profileData) !== null && _a !== void 0 ? _a : {});
134
134
  yield this.parentSetup(args);
135
135
  });
package/dist/lib/ast.js CHANGED
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.traverseAbstractSyntaxTree = exports.checkForOutOfBoundsImageImports = void 0;
7
+ exports.checkForOutOfBoundsImageImports = checkForOutOfBoundsImageImports;
8
+ exports.traverseAbstractSyntaxTree = traverseAbstractSyntaxTree;
8
9
  const path_1 = __importDefault(require("path"));
9
10
  // @ts-expect-error no type defs
10
11
  const estraverse_1 = require("estraverse");
@@ -82,7 +83,6 @@ function checkForOutOfBoundsImageImports(node, output, extensionPath) {
82
83
  }
83
84
  }
84
85
  }
85
- exports.checkForOutOfBoundsImageImports = checkForOutOfBoundsImageImports;
86
86
  function _processCrmPropertiesHook(node, output) {
87
87
  if (node.type !== 'CallExpression')
88
88
  return;
@@ -286,4 +286,3 @@ function traverseAbstractSyntaxTree(ast, checks, extensionPath, logger) {
286
286
  }
287
287
  return state;
288
288
  }
289
- exports.traverseAbstractSyntaxTree = traverseAbstractSyntaxTree;
package/dist/lib/build.js CHANGED
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.remoteBuild = exports.buildSingleExtension = exports.extensionErrorBaseMessage = void 0;
15
+ exports.extensionErrorBaseMessage = void 0;
16
+ exports.buildSingleExtension = buildSingleExtension;
17
+ exports.remoteBuild = remoteBuild;
16
18
  const vite_1 = require("vite");
17
19
  const constants_1 = require("./constants");
18
20
  const manifestPlugin_1 = __importDefault(require("./plugins/manifestPlugin"));
@@ -22,9 +24,9 @@ const codeBlockingPlugin_1 = __importDefault(require("./plugins/codeBlockingPlug
22
24
  const friendlyLoggingPlugin_1 = __importDefault(require("./plugins/friendlyLoggingPlugin"));
23
25
  const allowedExtensions = ['.js', '.ts', '.tsx', '.jsx'];
24
26
  exports.extensionErrorBaseMessage = `Supported file extensions are [${allowedExtensions.join(', ')}], received:`;
25
- function buildSingleExtension({ file, outputDir = constants_1.OUTPUT_DIR, emptyOutDir = true, minify = false, root = process.cwd(), // This is the vite default, so using that as our default
26
- logLevel = 'info', appConfig, }) {
27
- return __awaiter(this, void 0, void 0, function* () {
27
+ function buildSingleExtension(_a) {
28
+ return __awaiter(this, arguments, void 0, function* ({ file, outputDir = constants_1.OUTPUT_DIR, emptyOutDir = true, minify = false, root = process.cwd(), // This is the vite default, so using that as our default
29
+ logLevel = 'info', appConfig, }) {
28
30
  const output = (0, utils_1.getUrlSafeFileName)(file);
29
31
  yield (0, vite_1.build)({
30
32
  logLevel,
@@ -56,7 +58,6 @@ logLevel = 'info', appConfig, }) {
56
58
  });
57
59
  });
58
60
  }
59
- exports.buildSingleExtension = buildSingleExtension;
60
61
  function remoteBuild(args) {
61
62
  return __awaiter(this, void 0, void 0, function* () {
62
63
  const { root, entryPoint, outputDir = constants_1.OUTPUT_DIR, logLevel, appConfig, } = args;
@@ -82,4 +83,3 @@ function remoteBuild(args) {
82
83
  });
83
84
  });
84
85
  }
85
- exports.remoteBuild = remoteBuild;
@@ -5,7 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.loadLocalConfig = exports.validateProxyConfigValue = exports.validateProxyConfigKey = exports.loadExtensionConfig = exports.validateCardConfig = exports.loadConfigByPath = void 0;
8
+ exports.loadConfigByPath = loadConfigByPath;
9
+ exports.validateCardConfig = validateCardConfig;
10
+ exports.loadExtensionConfig = loadExtensionConfig;
11
+ exports.validateProxyConfigKey = validateProxyConfigKey;
12
+ exports.validateProxyConfigValue = validateProxyConfigValue;
13
+ exports.loadLocalConfig = loadLocalConfig;
9
14
  const fs_1 = __importDefault(require("fs"));
10
15
  const path_1 = __importDefault(require("path"));
11
16
  const utils_1 = require("./utils");
@@ -13,7 +18,6 @@ function loadConfigByPath(configPath) {
13
18
  const source = fs_1.default.readFileSync(configPath).toString();
14
19
  return JSON.parse(source);
15
20
  }
16
- exports.loadConfigByPath = loadConfigByPath;
17
21
  function validateCardConfig(config) {
18
22
  if (!config || typeof config !== 'object') {
19
23
  return new Error('Card config must be an object');
@@ -50,7 +54,6 @@ function validateCardConfig(config) {
50
54
  }
51
55
  return true;
52
56
  }
53
- exports.validateCardConfig = validateCardConfig;
54
57
  function loadExtensionConfig(appConfig, appPath) {
55
58
  var _a, _b;
56
59
  const crmCardsSubConfigFiles = (_b = (_a = appConfig === null || appConfig === void 0 ? void 0 : appConfig.extensions) === null || _a === void 0 ? void 0 : _a.crm) === null || _b === void 0 ? void 0 : _b.cards;
@@ -81,7 +84,6 @@ function loadExtensionConfig(appConfig, appPath) {
81
84
  });
82
85
  return outputConfig;
83
86
  }
84
- exports.loadExtensionConfig = loadExtensionConfig;
85
87
  function validateProxyConfigKey(urlKey, logger, localConfigPath) {
86
88
  try {
87
89
  const url = new URL(urlKey);
@@ -93,7 +95,6 @@ function validateProxyConfigKey(urlKey, logger, localConfigPath) {
93
95
  logger.warn(`The key "${urlKey}" in "${localConfigPath}" is an invalid url`);
94
96
  }
95
97
  }
96
- exports.validateProxyConfigKey = validateProxyConfigKey;
97
98
  function validateProxyConfigValue(value, key, logger, localConfigPath) {
98
99
  try {
99
100
  // eslint-disable-next-line no-new
@@ -103,7 +104,6 @@ function validateProxyConfigValue(value, key, logger, localConfigPath) {
103
104
  logger.warn(`The value "${value}" for key "${key}" in "${localConfigPath}" is an invalid url`);
104
105
  }
105
106
  }
106
- exports.validateProxyConfigValue = validateProxyConfigValue;
107
107
  function loadLocalConfig(appPath, logger) {
108
108
  const localConfigFilename = 'local.json';
109
109
  const localConfigPath = path_1.default.join(appPath, localConfigFilename);
@@ -125,4 +125,3 @@ function loadLocalConfig(appPath, logger) {
125
125
  return undefined;
126
126
  }
127
127
  }
128
- exports.loadLocalConfig = loadLocalConfig;
package/dist/lib/dev.js CHANGED
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.startDevMode = void 0;
15
+ exports.startDevMode = startDevMode;
16
16
  const vite_1 = require("vite");
17
17
  const path_1 = __importDefault(require("path"));
18
18
  const server_1 = __importDefault(require("./server"));
@@ -73,4 +73,3 @@ function startDevMode(devServerState) {
73
73
  return shutdownServer;
74
74
  });
75
75
  }
76
- exports.startDevMode = startDevMode;
@@ -23,13 +23,9 @@ class ExtensionsService {
23
23
  const output = path_1.default.parse(baseMessage.callback).name;
24
24
  return Object.assign(Object.assign({}, baseMessage), { manifest: (0, utils_1.loadManifest)(devServerState.outputDir, output) });
25
25
  });
26
- const response = {
27
- websocket: `ws://localhost:${devServerState.webSocketPort}`,
28
- version: constants_1.EXTENSIONS_MESSAGE_VERSION,
29
- capabilities,
30
- portalId: devServerState.portalId,
31
- extensions,
32
- };
26
+ const response = Object.assign({ websocket: `ws://localhost:${devServerState.webSocketPort}`, version: constants_1.EXTENSIONS_MESSAGE_VERSION, capabilities, portalId: devServerState.portalId, extensions }, (devServerState.functionsConfig.platformVersion && {
27
+ platformVersion: devServerState.functionsConfig.platformVersion,
28
+ }));
33
29
  res.status(200).json(response);
34
30
  }
35
31
  catch (e) {
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFunctionInvoked = exports.isIdentifierDefined = exports.isVariableImported = exports.getValueFromNode = void 0;
3
+ exports.getValueFromNode = getValueFromNode;
4
+ exports.isVariableImported = isVariableImported;
5
+ exports.isIdentifierDefined = isIdentifierDefined;
6
+ exports.isFunctionInvoked = isFunctionInvoked;
4
7
  /**
5
8
  * Extracts the value from a given AST node based on its type.
6
9
  * This function handles various node types such as Literal, Identifier (aka variables), ArrayExpression,
@@ -265,7 +268,6 @@ function getValueFromNode(node, state) {
265
268
  };
266
269
  }
267
270
  }
268
- exports.getValueFromNode = getValueFromNode;
269
271
  function isVariableImported(node, variableName) {
270
272
  if (!node) {
271
273
  return false;
@@ -276,7 +278,6 @@ function isVariableImported(node, variableName) {
276
278
  (node.type === 'ImportNamespaceSpecifier' &&
277
279
  node.local.name === variableName));
278
280
  }
279
- exports.isVariableImported = isVariableImported;
280
281
  function isIdentifierDefined(node, parent, name) {
281
282
  if (parent &&
282
283
  (parent.type === 'MemberExpression' || parent.type === 'CallExpression')) {
@@ -284,11 +285,9 @@ function isIdentifierDefined(node, parent, name) {
284
285
  }
285
286
  return node.type === 'Identifier' && node.name === name;
286
287
  }
287
- exports.isIdentifierDefined = isIdentifierDefined;
288
288
  function isFunctionInvoked(node, functionName) {
289
289
  return (node.type === 'CallExpression' &&
290
290
  node.callee &&
291
291
  'name' in node.callee &&
292
292
  node.callee.name === functionName);
293
293
  }
294
- exports.isFunctionInvoked = isFunctionInvoked;
@@ -6,7 +6,7 @@ const ast_1 = require("../ast");
6
6
  const codeBlockingPlugin = ({ logger, extensionPath }) => {
7
7
  return {
8
8
  name: 'ui-extensions-code-blocking-plugin',
9
- enforce: 'post',
9
+ enforce: 'post', // run after default rollup plugins
10
10
  transform(code, filename) {
11
11
  if ((0, utils_1.isNodeModule)(filename)) {
12
12
  return { code, map: null }; // We don't want to parse node modules
@@ -17,13 +17,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
17
17
  }) : function(o, v) {
18
18
  o["default"] = v;
19
19
  });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
27
37
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
28
38
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
39
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -76,7 +86,7 @@ const devBuildPlugin = (options) => {
76
86
  } }));
77
87
  }
78
88
  };
79
- const devBuild = (server, extensionMetadata, emptyOutDir = false) => __awaiter(void 0, void 0, void 0, function* () {
89
+ const devBuild = (server_1, extensionMetadata_1, ...args_1) => __awaiter(void 0, [server_1, extensionMetadata_1, ...args_1], void 0, function* (server, extensionMetadata, emptyOutDir = false) {
80
90
  try {
81
91
  const { config: extensionConfig } = extensionMetadata;
82
92
  const { extensionPath } = extensionConfig;
@@ -168,7 +178,7 @@ const devBuildPlugin = (options) => {
168
178
  yield devBuild(localServer, devServerState.extensionsMetadata[i], i === 0);
169
179
  }
170
180
  }),
171
- handleHotUpdate: ({ file, server }) => __awaiter(void 0, void 0, void 0, function* () {
181
+ handleHotUpdate: (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, server }) {
172
182
  // If the file is not in the relevantModules list, it's update is inconsequential
173
183
  const extensionsToRebuild = devServerState.extensionsMetadata.filter((metadata) => {
174
184
  const { config } = metadata;
@@ -17,7 +17,7 @@ const manifestPlugin = (options) => {
17
17
  let allDataDependencies;
18
18
  return {
19
19
  name: 'ui-extensions-manifest-generation-plugin',
20
- enforce: 'post',
20
+ enforce: 'post', // run after default rollup plugins
21
21
  buildStart() {
22
22
  // Reset the source metadata for the new build
23
23
  allDataDependencies = [];
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRelevantModules = void 0;
3
+ exports.getRelevantModules = getRelevantModules;
4
4
  const utils_1 = require("../utils");
5
5
  const relevantModules = {};
6
6
  function getRelevantModules(output) {
7
7
  return relevantModules[output] || [];
8
8
  }
9
- exports.getRelevantModules = getRelevantModules;
10
9
  const relevantModulesPlugin = ({ output, logger }) => {
11
10
  return {
12
11
  name: 'ui-extensions-relevant-modules-plugin',
@@ -31,9 +31,9 @@ function listen(app, port) {
31
31
  });
32
32
  });
33
33
  }
34
- function startDevServer({ devServerState, viteDevServer, }) {
35
- var _a;
36
- return __awaiter(this, void 0, void 0, function* () {
34
+ function startDevServer(_a) {
35
+ return __awaiter(this, arguments, void 0, function* ({ devServerState, viteDevServer, }) {
36
+ var _b;
37
37
  const app = (0, express_1.default)();
38
38
  // Setup middleware
39
39
  app.use((0, cors_1.default)());
@@ -75,7 +75,7 @@ function startDevServer({ devServerState, viteDevServer, }) {
75
75
  }
76
76
  throw new Error(e);
77
77
  }
78
- (_a = devServerState.extensionsMetadata) === null || _a === void 0 ? void 0 : _a.forEach((metadata) => {
78
+ (_b = devServerState.extensionsMetadata) === null || _b === void 0 ? void 0 : _b.forEach((metadata) => {
79
79
  const { baseMessage } = metadata;
80
80
  devServerState.logger.debug(`Listening at ${baseMessage.callback}`);
81
81
  });
package/dist/lib/utils.js CHANGED
@@ -3,7 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isImage = exports.generateHash = exports.extractAllowedUrls = exports.throwUnhandledPlatformVersionError = exports.UnhandledPlatformVersionError = exports.isExtensionFile = exports.isNodeModule = exports.buildSourceId = exports.loadManifest = exports.stripAnsiColorCodes = exports.getUrlSafeFileName = void 0;
6
+ exports.UnhandledPlatformVersionError = void 0;
7
+ exports.getUrlSafeFileName = getUrlSafeFileName;
8
+ exports.stripAnsiColorCodes = stripAnsiColorCodes;
9
+ exports.loadManifest = loadManifest;
10
+ exports.buildSourceId = buildSourceId;
11
+ exports.isNodeModule = isNodeModule;
12
+ exports.isExtensionFile = isExtensionFile;
13
+ exports.throwUnhandledPlatformVersionError = throwUnhandledPlatformVersionError;
14
+ exports.extractAllowedUrls = extractAllowedUrls;
15
+ exports.generateHash = generateHash;
16
+ exports.isImage = isImage;
7
17
  const path_1 = __importDefault(require("path"));
8
18
  const fs_1 = __importDefault(require("fs"));
9
19
  const constants_1 = require("./constants");
@@ -11,7 +21,6 @@ function getUrlSafeFileName(filePath) {
11
21
  const { name } = path_1.default.parse(filePath);
12
22
  return encodeURIComponent(`${name}.js`);
13
23
  }
14
- exports.getUrlSafeFileName = getUrlSafeFileName;
15
24
  // Strips ANSI color codes out of strings because we don't want to pass them to the browser
16
25
  function stripAnsiColorCodes(stringWithColorCodes) {
17
26
  if (!stringWithColorCodes) {
@@ -21,7 +30,6 @@ function stripAnsiColorCodes(stringWithColorCodes) {
21
30
  // eslint-disable-next-line no-control-regex
22
31
  /[\u001b][[]*([0-9]{1,4};?)*[m]/g, '');
23
32
  }
24
- exports.stripAnsiColorCodes = stripAnsiColorCodes;
25
33
  function loadManifest(outputDir, output) {
26
34
  try {
27
35
  return JSON.parse(fs_1.default
@@ -32,14 +40,12 @@ function loadManifest(outputDir, output) {
32
40
  return {};
33
41
  }
34
42
  }
35
- exports.loadManifest = loadManifest;
36
43
  function buildSourceId(appConfig, extensionConfig) {
37
44
  if (appConfig.uid && extensionConfig.data.uid) {
38
45
  return `${appConfig.uid}::${extensionConfig.data.uid}`;
39
46
  }
40
47
  return null;
41
48
  }
42
- exports.buildSourceId = buildSourceId;
43
49
  function isNodeModule(filepath) {
44
50
  if (!filepath) {
45
51
  return false;
@@ -47,7 +53,6 @@ function isNodeModule(filepath) {
47
53
  const directory = path_1.default.parse(filepath).dir;
48
54
  return directory.includes('node_modules');
49
55
  }
50
- exports.isNodeModule = isNodeModule;
51
56
  /**
52
57
  * Check if a given file is within the extension path
53
58
  */
@@ -62,12 +67,11 @@ function isExtensionFile(filepath, extensionPath) {
62
67
  return !relativePath.startsWith('..') && !path_1.default.isAbsolute(relativePath);
63
68
  }
64
69
  catch (e) {
65
- console.log(`Error checking if ${filepath} is in extension path: ${e}`);
70
+ // console.log(`Error checking if ${filepath} is in extension path: ${e}`);
66
71
  // If there's an error, we can't determine if the file is in the extension path, so return false.
67
72
  return false;
68
73
  }
69
74
  }
70
- exports.isExtensionFile = isExtensionFile;
71
75
  class UnhandledPlatformVersionError extends Error {
72
76
  constructor(platformVersion) {
73
77
  super(`Unsupported platform version "${platformVersion}"`);
@@ -77,14 +81,12 @@ exports.UnhandledPlatformVersionError = UnhandledPlatformVersionError;
77
81
  function throwUnhandledPlatformVersionError(platformVersion) {
78
82
  throw new UnhandledPlatformVersionError(platformVersion);
79
83
  }
80
- exports.throwUnhandledPlatformVersionError = throwUnhandledPlatformVersionError;
81
84
  function extractAllowedUrls(appConfig) {
82
85
  if (!appConfig || !('allowedUrls' in appConfig) || !appConfig.allowedUrls) {
83
86
  return [];
84
87
  }
85
88
  return appConfig.allowedUrls;
86
89
  }
87
- exports.extractAllowedUrls = extractAllowedUrls;
88
90
  function simpleHash(input) {
89
91
  let hash = 0;
90
92
  for (let i = 0; i < input.length; i++) {
@@ -120,11 +122,9 @@ function generateHash(...args) {
120
122
  return '';
121
123
  }
122
124
  }
123
- exports.generateHash = generateHash;
124
125
  /**
125
126
  * Check if a given URL is an image (of a type we support)
126
127
  */
127
128
  function isImage(url) {
128
129
  return /\.(png|jpg|jpeg|gif|svg|webp|avif|raw|url|inline)$/.test(url);
129
130
  }
130
- exports.isImage = isImage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions-dev-server",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "uie": "./dist/lib/bin/cli.js"
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@hubspot/app-functions-dev-server": "0.10.0",
30
+ "@hubspot/app-functions-dev-server": "0.10.1",
31
31
  "body-parser": "1.20.3",
32
32
  "chalk": "5.4.1",
33
33
  "commander": "13.0.0",
@@ -49,7 +49,7 @@
49
49
  "axios": "1.6.8",
50
50
  "jest": "^29.5.0",
51
51
  "ts-jest": "^29.1.1",
52
- "typescript": "^5.1.6",
52
+ "typescript": "^5.9.2",
53
53
  "ws": "^8.13.0"
54
54
  },
55
55
  "eslintConfig": {
@@ -70,5 +70,5 @@
70
70
  "optional": true
71
71
  }
72
72
  },
73
- "gitHead": "34ce86d7cfaa1f163bf67838bbb56c054d0f72cc"
73
+ "gitHead": "e2b4235a577b2c9ec027f2646ebf4268374fe28b"
74
74
  }