@forge/lint 6.0.3-next.2 → 6.0.3-next.20

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 CHANGED
@@ -1,5 +1,140 @@
1
1
  # @forge/lint
2
2
 
3
+ ## 6.0.3-next.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [87d2d74]
8
+ - @forge/csp@6.3.0-next.0
9
+
10
+ ## 6.0.3-next.19
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [4404f62]
15
+ - @forge/manifest@13.3.0-next.10
16
+ - @forge/cli-shared@9.3.0-next.18
17
+
18
+ ## 6.0.3-next.18
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [8d20095]
23
+ - @forge/cli-shared@9.3.0-next.17
24
+
25
+ ## 6.0.3-next.17
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [905d8c5]
30
+ - @forge/cli-shared@9.3.0-next.16
31
+
32
+ ## 6.0.3-next.16
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [52e074e]
37
+ - @forge/cli-shared@9.3.0-next.15
38
+
39
+ ## 6.0.3-next.15
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [c8105d8]
44
+ - Updated dependencies [3e8de63]
45
+ - @forge/cli-shared@9.3.0-next.14
46
+ - @forge/manifest@13.3.0-next.9
47
+
48
+ ## 6.0.3-next.14
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [8a9e608]
53
+ - @forge/cli-shared@9.3.0-next.13
54
+
55
+ ## 6.0.3-next.13
56
+
57
+ ### Patch Changes
58
+
59
+ - 4b90a07: Lint target directory when using the manual packaging
60
+ - Updated dependencies [4b90a07]
61
+ - @forge/manifest@13.3.0-next.8
62
+ - @forge/cli-shared@9.3.0-next.12
63
+
64
+ ## 6.0.3-next.12
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [18b920d]
69
+ - @forge/cli-shared@9.3.0-next.11
70
+
71
+ ## 6.0.3-next.11
72
+
73
+ ### Patch Changes
74
+
75
+ - 0f6f64f: Fix linter setup to support multi-entry resource bundling for Frame component
76
+
77
+ ## 6.0.3-next.10
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies [bc2d278]
82
+ - @forge/cli-shared@9.3.0-next.10
83
+
84
+ ## 6.0.3-next.9
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [a36d70b]
89
+ - @forge/cli-shared@9.3.0-next.9
90
+
91
+ ## 6.0.3-next.8
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies [89ccb1e]
96
+ - @forge/manifest@13.3.0-next.7
97
+ - @forge/cli-shared@9.3.0-next.8
98
+
99
+ ## 6.0.3-next.7
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [e7bfe5e]
104
+ - @forge/cli-shared@9.3.0-next.7
105
+ - @forge/manifest@13.3.0-next.6
106
+
107
+ ## 6.0.3-next.6
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [0949833]
112
+ - @forge/cli-shared@9.3.0-next.6
113
+
114
+ ## 6.0.3-next.5
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [d1610cc]
119
+ - @forge/manifest@13.3.0-next.5
120
+ - @forge/cli-shared@9.3.0-next.5
121
+
122
+ ## 6.0.3-next.4
123
+
124
+ ### Patch Changes
125
+
126
+ - Updated dependencies [c3a0f20]
127
+ - @forge/manifest@13.3.0-next.4
128
+ - @forge/cli-shared@9.3.0-next.4
129
+
130
+ ## 6.0.3-next.3
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies [498fda5]
135
+ - @forge/manifest@13.3.0-next.3
136
+ - @forge/cli-shared@9.3.0-next.3
137
+
3
138
  ## 6.0.3-next.2
4
139
 
5
140
  ### Patch Changes
@@ -3,11 +3,11 @@ import { LintClass, LintResultRule } from '../../../linter-interface';
3
3
  import { BaseLintIssueVerifier, LintIssueVerifier } from '../../verifier-interface';
4
4
  import { type FrameResourceInfo } from '../frame-component-interface';
5
5
  export declare class FrameComponentVerifier extends BaseLintIssueVerifier implements LintIssueVerifier<FrameResourceInfo[]> {
6
- private possibleFrameResourceKeys;
6
+ private entryKeysByResourceKey;
7
7
  constructor(environment: string, manifest: Manifest);
8
8
  protected getLintClass(): LintClass;
9
9
  process(frameResources: FrameResourceInfo[]): Promise<LintResultRule[]>;
10
10
  private isValidFrameResourceKey;
11
- private getPossibleFrameResourceKeysFromManifest;
11
+ private getEntryKeysByResourceKeyFromManifest;
12
12
  }
13
13
  //# sourceMappingURL=frame-component-verifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frame-component-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/frame-component-linter/verifiers/frame-component-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,qBAAa,sBAAuB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;IACjH,OAAO,CAAC,yBAAyB,CAAc;gBAEnC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAKnD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,cAAc,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAepF,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,wCAAwC;CAQjD"}
1
+ {"version":3,"file":"frame-component-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/frame-component-linter/verifiers/frame-component-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,qBAAa,sBAAuB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;IAIjH,OAAO,CAAC,sBAAsB,CAA2B;gBAE7C,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAKnD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,cAAc,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAepF,OAAO,CAAC,uBAAuB;IAmB/B,OAAO,CAAC,qCAAqC;CAQ9C"}
@@ -5,10 +5,10 @@ const linter_interface_1 = require("../../../linter-interface");
5
5
  const verifier_interface_1 = require("../../verifier-interface");
6
6
  const text_1 = require("../../../text");
7
7
  class FrameComponentVerifier extends verifier_interface_1.BaseLintIssueVerifier {
8
- possibleFrameResourceKeys;
8
+ entryKeysByResourceKey;
9
9
  constructor(environment, manifest) {
10
10
  super(environment, manifest);
11
- this.possibleFrameResourceKeys = this.getPossibleFrameResourceKeysFromManifest();
11
+ this.entryKeysByResourceKey = this.getEntryKeysByResourceKeyFromManifest();
12
12
  }
13
13
  getLintClass() {
14
14
  return linter_interface_1.LintClass.Error;
@@ -31,11 +31,19 @@ class FrameComponentVerifier extends verifier_interface_1.BaseLintIssueVerifier
31
31
  if (!resourceKey) {
32
32
  return false;
33
33
  }
34
- return this.possibleFrameResourceKeys.has(resourceKey);
34
+ const separatorIndex = resourceKey.indexOf('/');
35
+ if (separatorIndex === -1) {
36
+ const entryKeys = this.entryKeysByResourceKey.get(resourceKey);
37
+ return !!entryKeys && entryKeys.size === 0;
38
+ }
39
+ const key = resourceKey.slice(0, separatorIndex);
40
+ const entry = resourceKey.slice(separatorIndex + 1);
41
+ const entryKeys = this.entryKeysByResourceKey.get(key);
42
+ return entry.length > 0 && entryKeys !== undefined && entryKeys.has(entry);
35
43
  }
36
- getPossibleFrameResourceKeysFromManifest() {
44
+ getEntryKeysByResourceKeyFromManifest() {
37
45
  const resources = this.manifest?.resources ?? [];
38
- return new Set(resources.map(({ key }) => key));
46
+ return new Map(resources.map(({ key, entry }) => [key, new Set(entry ? Object.keys(entry) : [])]));
39
47
  }
40
48
  }
41
49
  exports.FrameComponentVerifier = FrameComponentVerifier;
@@ -10,7 +10,8 @@ export declare class HandlerLinter extends BaseLinter<ExportedMethod, HandlerLin
10
10
  private manifest;
11
11
  constructor(environment: string, manifest: Manifest, logger: LintLogger);
12
12
  bootstrap(): Promise<void>;
13
- private getHandlerFileRegex;
13
+ private escapeRegExp;
14
+ private isHandlerFile;
14
15
  private getFunctionHandlers;
15
16
  protected setupMatchesMap(filepath: string): void;
16
17
  protected filterLintInput(inputs: LintInput[]): LintInput[];
@@ -1 +1 @@
1
- {"version":3,"file":"handler-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/handler-linter/handler-linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAW,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,0BAA0B;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,gBAAgB,EAAE,aAAa,CAAC;CACjC;AAED,qBAAa,aAAc,SAAQ,UAAU,CAAC,cAAc,EAAE,0BAA0B,EAAE,aAAa,CAAC;IAGpG,OAAO,CAAC,QAA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AAC,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAK3D,SAAS,CAAC,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAKvF"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HandlerLinter = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const cli_shared_1 = require("@forge/cli-shared");
6
+ const manifest_1 = require("@forge/manifest");
6
7
  const base_linter_1 = tslib_1.__importDefault(require("../../base-linter"));
7
8
  const handlers_verifier_1 = require("./verifiers/handlers-verifier");
8
9
  const visitors_1 = require("./visitors");
@@ -19,7 +20,12 @@ class HandlerLinter extends base_linter_1.default {
19
20
  functionHandlers: new handlers_verifier_1.HandlersVerifier(humanReadableEnvironment, this.manifest)
20
21
  };
21
22
  }
22
- getHandlerFileRegex = (fileName) => new RegExp(`^src(\/|\\\\)${fileName}\.[tj](s|sx)$`);
23
+ escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
24
+ isHandlerFile(handler, filepath) {
25
+ const handlersDirectory = (0, manifest_1.getHandlersDirectory)(this.manifest);
26
+ const handlerFileRegex = new RegExp(`^${this.escapeRegExp(handlersDirectory)}(\/|\\\\)${this.escapeRegExp(handler.file)}\.[tj](s|sx)$`);
27
+ return handlerFileRegex.test(filepath);
28
+ }
23
29
  getFunctionHandlers(manifest) {
24
30
  return manifest.modules?.function
25
31
  ?.filter((funcs) => funcs.handler && funcs.handler.split('.').length === 2)
@@ -35,7 +41,7 @@ class HandlerLinter extends base_linter_1.default {
35
41
  }
36
42
  setupMatchesMap(filepath) {
37
43
  const handlers = this.getFunctionHandlers(this.manifest);
38
- const filteredHandlers = handlers?.filter((handler) => this.getHandlerFileRegex(handler.file).test(filepath));
44
+ const filteredHandlers = handlers?.filter((handler) => this.isHandlerFile(handler, filepath));
39
45
  this.matches.set(filepath, {
40
46
  functionHandlers: {
41
47
  expectedMethods: filteredHandlers || [],
@@ -45,7 +51,7 @@ class HandlerLinter extends base_linter_1.default {
45
51
  }
46
52
  filterLintInput(inputs) {
47
53
  const handlers = this.getFunctionHandlers(this.manifest);
48
- return inputs.filter((input) => handlers?.find((handler) => this.getHandlerFileRegex(handler.file).test(input.filepath)));
54
+ return inputs.filter((input) => handlers?.find((handler) => this.isHandlerFile(handler, input.filepath)));
49
55
  }
50
56
  addLintCriteriaMatch(exportedMethod, filepath) {
51
57
  const criteriaMatches = this.matches.get(filepath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/lint",
3
- "version": "6.0.3-next.2",
3
+ "version": "6.0.3-next.20",
4
4
  "description": "Linting for forge apps",
5
5
  "main": "out/index.js",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -19,10 +19,10 @@
19
19
  "eslint-plugin-import": "^2.29.1"
20
20
  },
21
21
  "dependencies": {
22
- "@forge/cli-shared": "9.3.0-next.2",
23
- "@forge/csp": "6.2.0",
22
+ "@forge/cli-shared": "9.3.0-next.18",
23
+ "@forge/csp": "6.3.0-next.0",
24
24
  "@forge/egress": "3.0.0",
25
- "@forge/manifest": "13.3.0-next.2",
25
+ "@forge/manifest": "13.3.0-next.10",
26
26
  "@typescript-eslint/typescript-estree": "^5.62.0",
27
27
  "array.prototype.flatmap": "^1.3.3",
28
28
  "@atlassian/atlassian-openapi": "^1.0.6",