@hubspot/project-parsing-lib 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/project-parsing-lib",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "Parsing library for converting projects directory structures to their intermediate representation",
5
5
  "license": "Apache-2.0",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -10,6 +10,7 @@ const files_1 = require("./lib/files");
10
10
  const validation_1 = require("./lib/validation");
11
11
  const transform_1 = require("./lib/transform");
12
12
  const copy_1 = require("./lang/copy");
13
+ const utils_1 = require("./lib/utils");
13
14
  const path_1 = __importDefault(require("path"));
14
15
  const defaultOptions = {
15
16
  skipValidation: false,
@@ -43,7 +44,17 @@ async function translateForLocalDev(translationContext, translationOptions) {
43
44
  Object.entries(IR.intermediateNodesIndexedByUid).forEach(([uid, node]) => {
44
45
  const component = IR.intermediateNodesIndexedByUid[uid];
45
46
  const componentConfigPath = path_1.default.join(translationContext.projectSourceDir, component.metaFilePath);
46
- const configUpdatedSinceLastUpload = Boolean(translationOptions?.configFilesUpdatedSinceLastUpload?.has(componentConfigPath));
47
+ let configUpdatedSinceLastUpload = false;
48
+ if (translationOptions?.projectNodesAtLastUpload) {
49
+ const componentAtLastUpload = translationOptions.projectNodesAtLastUpload[uid];
50
+ if (componentAtLastUpload) {
51
+ configUpdatedSinceLastUpload = !(0, utils_1.isDeepEqual)(component.config, componentAtLastUpload.config);
52
+ }
53
+ else {
54
+ // Component is net new
55
+ configUpdatedSinceLastUpload = true;
56
+ }
57
+ }
47
58
  localDevIr.intermediateNodesIndexedByUid[uid] = {
48
59
  ...node,
49
60
  localDev: {
@@ -1,5 +1,6 @@
1
1
  export declare const AppKey = "app";
2
2
  export declare const ThemeKey = "theme";
3
+ export declare const ReactThemeKey = "react-theme";
3
4
  export declare const AppEventsKey = "app-event";
4
5
  export declare const AppFunctionsKey = "app-function";
5
6
  export declare const AppObjectKey = "app-object";
@@ -33,12 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.allowedSubComponentDirectories = exports.allowedComponentDirectories = exports.ProjectStructure = exports.allowedThemeSubComponentsDirs = exports.allowedAppSubComponentsDirs = exports.packageLockJson = exports.packageJson = exports.hsProjectJsonFilename = exports.profileFilePrefix = exports.metafileExtension = exports.internalTypeToUserFacing = exports.userFacingToInternalType = exports.Components = exports.AutoGeneratedComponentTypes = exports.AppFunctionsPackageKey = exports.WorkflowActionsKey = exports.WebhooksKey = exports.VideoConferencingKey = exports.TelemetryKey = exports.SettingsKey = exports.MediaBridgeKey = exports.MarketingEventsKey = exports.SCIMKey = exports.CardsKey = exports.CallingKey = exports.AppObjectAssociationKey = exports.AppObjectKey = exports.AppFunctionsKey = exports.AppEventsKey = exports.ThemeKey = exports.AppKey = void 0;
36
+ exports.allowedSubComponentDirectories = exports.allowedComponentDirectories = exports.ProjectStructure = exports.allowedThemeSubComponentsDirs = exports.allowedAppSubComponentsDirs = exports.packageLockJson = exports.packageJson = exports.hsProjectJsonFilename = exports.profileFilePrefix = exports.metafileExtension = exports.internalTypeToUserFacing = exports.userFacingToInternalType = exports.Components = exports.AutoGeneratedComponentTypes = exports.AppFunctionsPackageKey = exports.WorkflowActionsKey = exports.WebhooksKey = exports.VideoConferencingKey = exports.TelemetryKey = exports.SettingsKey = exports.MediaBridgeKey = exports.MarketingEventsKey = exports.SCIMKey = exports.CardsKey = exports.CallingKey = exports.AppObjectAssociationKey = exports.AppObjectKey = exports.AppFunctionsKey = exports.AppEventsKey = exports.ReactThemeKey = exports.ThemeKey = exports.AppKey = void 0;
37
37
  // Top Level Component types
38
38
  const path = __importStar(require("path"));
39
39
  // Component types
40
40
  exports.AppKey = 'app';
41
41
  exports.ThemeKey = 'theme';
42
+ exports.ReactThemeKey = 'react-theme';
42
43
  // Sub-Component types
43
44
  exports.AppEventsKey = 'app-event';
44
45
  exports.AppFunctionsKey = 'app-function';
@@ -91,6 +92,11 @@ exports.Components = {
91
92
  userFriendlyName: 'Theme',
92
93
  ...TopLevelComponentFields,
93
94
  },
95
+ [exports.ReactThemeKey]: {
96
+ dir: exports.ReactThemeKey,
97
+ userFriendlyName: 'React Theme',
98
+ ...TopLevelComponentFields,
99
+ },
94
100
  [exports.CallingKey]: {
95
101
  dir: exports.CallingKey,
96
102
  parentComponent: exports.AppKey,
@@ -60,7 +60,9 @@ export interface TranslationOptions {
60
60
  profile?: string;
61
61
  }
62
62
  export interface TranslationOptionsLocalDev extends TranslationOptions {
63
- configFilesUpdatedSinceLastUpload?: Set<string>;
63
+ projectNodesAtLastUpload?: {
64
+ [key: string]: IntermediateRepresentationNodeLocalDev;
65
+ };
64
66
  }
65
67
  export interface HsProfileFile {
66
68
  accountId: number;
@@ -0,0 +1 @@
1
+ export declare function isDeepEqual(object1: unknown, object2: unknown): boolean;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDeepEqual = isDeepEqual;
4
+ function isDeepEqual(object1, object2) {
5
+ if (object1 === object2) {
6
+ return true;
7
+ }
8
+ if (object1 === null ||
9
+ object2 === null ||
10
+ typeof object1 !== 'object' ||
11
+ typeof object2 !== 'object') {
12
+ return object1 === object2;
13
+ }
14
+ if (typeof object1 !== typeof object2) {
15
+ return false;
16
+ }
17
+ const objKeys1 = Object.keys(object1);
18
+ const objKeys2 = Object.keys(object2);
19
+ if (objKeys1.length !== objKeys2.length)
20
+ return false;
21
+ for (const key of objKeys1) {
22
+ const value1 = object1[key];
23
+ const value2 = object2[key];
24
+ if (!isDeepEqual(value1, value2)) {
25
+ return false;
26
+ }
27
+ }
28
+ return true;
29
+ }