@atlassian/clientside-extensions-webpack-plugin 3.1.2-test9-85e70efb → 4.0.0-5d495e8a-m8zwocnp

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.
Files changed (149) hide show
  1. package/README.md +4 -3
  2. package/dist/cjs/ClientsideExtensionsWebpackPlugin.js +59 -50
  3. package/dist/cjs/ClientsideExtensionsWebpackPlugin.js.map +1 -1
  4. package/dist/cjs/annotations/condition.js +2 -6
  5. package/dist/cjs/annotations/condition.js.map +1 -1
  6. package/dist/cjs/annotations/default-parser.js +1 -1
  7. package/dist/cjs/annotations/default-parser.js.map +1 -1
  8. package/dist/cjs/annotations/extension-point.js.map +1 -1
  9. package/dist/cjs/annotations/index.js +2 -2
  10. package/dist/cjs/annotations/index.js.map +1 -1
  11. package/dist/cjs/annotations/key.js +1 -1
  12. package/dist/cjs/annotations/key.js.map +1 -1
  13. package/dist/cjs/annotations/label.js +2 -2
  14. package/dist/cjs/annotations/label.js.map +1 -1
  15. package/dist/cjs/annotations/link.js +2 -2
  16. package/dist/cjs/annotations/link.js.map +1 -1
  17. package/dist/cjs/annotations/page-data-provider.js +1 -3
  18. package/dist/cjs/annotations/page-data-provider.js.map +1 -1
  19. package/dist/cjs/annotations/page-decorator.js +2 -6
  20. package/dist/cjs/annotations/page-decorator.js.map +1 -1
  21. package/dist/cjs/annotations/page-title.js +1 -3
  22. package/dist/cjs/annotations/page-title.js.map +1 -1
  23. package/dist/cjs/annotations/page-url.js +2 -6
  24. package/dist/cjs/annotations/page-url.js.map +1 -1
  25. package/dist/cjs/annotations/parsers.js +14 -10
  26. package/dist/cjs/annotations/parsers.js.map +1 -1
  27. package/dist/cjs/annotations/types.js.map +1 -1
  28. package/dist/cjs/annotations/weight.js +4 -1
  29. package/dist/cjs/annotations/weight.js.map +1 -1
  30. package/dist/cjs/generator/conditions.js +2 -2
  31. package/dist/cjs/generator/conditions.js.map +1 -1
  32. package/dist/cjs/generator/entrypoint.js +27 -5
  33. package/dist/cjs/generator/entrypoint.js.map +1 -1
  34. package/dist/cjs/generator/webfragmentDescriptor.js +28 -0
  35. package/dist/cjs/generator/webfragmentDescriptor.js.map +1 -0
  36. package/dist/cjs/generator/{webpage-descriptor.js → webpageDescriptor.js} +11 -7
  37. package/dist/cjs/generator/webpageDescriptor.js.map +1 -0
  38. package/dist/cjs/generator/xml.js +51 -0
  39. package/dist/cjs/generator/xml.js.map +1 -0
  40. package/dist/cjs/runtime/extension-entrypoint.js +4 -3
  41. package/dist/cjs/runtime/web-page-entrypoint.js +7 -3
  42. package/dist/cjs/tests/test-helper.js +29 -0
  43. package/dist/cjs/tests/test-helper.js.map +1 -0
  44. package/dist/cjs/transform-comment.js +7 -5
  45. package/dist/cjs/transform-comment.js.map +1 -1
  46. package/dist/cjs/types.js.map +1 -1
  47. package/dist/cjs/utils.js +25 -3
  48. package/dist/cjs/utils.js.map +1 -1
  49. package/dist/types/ClientsideExtensionsWebpackPlugin.d.ts +22 -25
  50. package/dist/types/ClientsideExtensionsWebpackPlugin.d.ts.map +1 -1
  51. package/dist/types/annotations/condition.d.ts +2 -2
  52. package/dist/types/annotations/condition.d.ts.map +1 -1
  53. package/dist/types/annotations/default-parser.d.ts +2 -2
  54. package/dist/types/annotations/default-parser.d.ts.map +1 -1
  55. package/dist/types/annotations/extension-point.d.ts +2 -2
  56. package/dist/types/annotations/extension-point.d.ts.map +1 -1
  57. package/dist/types/annotations/index.d.ts +1 -1
  58. package/dist/types/annotations/index.d.ts.map +1 -1
  59. package/dist/types/annotations/key.d.ts +2 -2
  60. package/dist/types/annotations/key.d.ts.map +1 -1
  61. package/dist/types/annotations/label.d.ts +2 -2
  62. package/dist/types/annotations/label.d.ts.map +1 -1
  63. package/dist/types/annotations/link.d.ts +2 -2
  64. package/dist/types/annotations/link.d.ts.map +1 -1
  65. package/dist/types/annotations/page-data-provider.d.ts +2 -2
  66. package/dist/types/annotations/page-data-provider.d.ts.map +1 -1
  67. package/dist/types/annotations/page-decorator.d.ts +2 -2
  68. package/dist/types/annotations/page-decorator.d.ts.map +1 -1
  69. package/dist/types/annotations/page-title.d.ts +2 -2
  70. package/dist/types/annotations/page-title.d.ts.map +1 -1
  71. package/dist/types/annotations/page-url.d.ts +2 -2
  72. package/dist/types/annotations/page-url.d.ts.map +1 -1
  73. package/dist/types/annotations/types.d.ts +2 -2
  74. package/dist/types/annotations/types.d.ts.map +1 -1
  75. package/dist/types/annotations/weight.d.ts +2 -2
  76. package/dist/types/annotations/weight.d.ts.map +1 -1
  77. package/dist/types/generator/conditions.d.ts +3 -2
  78. package/dist/types/generator/conditions.d.ts.map +1 -1
  79. package/dist/types/generator/entrypoint.d.ts +1 -1
  80. package/dist/types/generator/entrypoint.d.ts.map +1 -1
  81. package/dist/types/generator/webfragmentDescriptor.d.ts +10 -0
  82. package/dist/types/generator/webfragmentDescriptor.d.ts.map +1 -0
  83. package/dist/types/generator/{webpage-descriptor.d.ts → webpageDescriptor.d.ts} +3 -3
  84. package/dist/types/generator/webpageDescriptor.d.ts.map +1 -0
  85. package/dist/types/generator/xml.d.ts +18 -0
  86. package/dist/types/generator/xml.d.ts.map +1 -0
  87. package/dist/types/tests/test-helper.d.ts +3 -0
  88. package/dist/types/tests/test-helper.d.ts.map +1 -0
  89. package/dist/types/transform-comment.d.ts +2 -2
  90. package/dist/types/transform-comment.d.ts.map +1 -1
  91. package/dist/types/types.d.ts +1 -1
  92. package/dist/types/types.d.ts.map +1 -1
  93. package/dist/types/utils.d.ts +6 -0
  94. package/dist/types/utils.d.ts.map +1 -1
  95. package/jest.config.js +11 -4
  96. package/lib/ClientsideExtensionsWebpackPlugin.basic.test.ts +62 -26
  97. package/lib/ClientsideExtensionsWebpackPlugin.conditions.test.ts +48 -60
  98. package/lib/ClientsideExtensionsWebpackPlugin.metadata.test.ts +45 -63
  99. package/lib/ClientsideExtensionsWebpackPlugin.ts +71 -53
  100. package/lib/ClientsideExtensionsWebpackPlugin.webpages.test.ts +57 -98
  101. package/lib/__fixtures__/.eslintrc.js +5 -0
  102. package/lib/__fixtures__/basic/extension-2.js +4 -2
  103. package/lib/__fixtures__/basic/first.js +0 -1
  104. package/lib/__fixtures__/basic/second.js +0 -1
  105. package/lib/__fixtures__/conditions/condition-with-params.extension.js +4 -2
  106. package/lib/__fixtures__/conditions/simple-condition.extension.js +4 -2
  107. package/lib/__fixtures__/conditions/two-conditions-with-params.extension.js +4 -2
  108. package/lib/__fixtures__/metadata/key_replacement_test.extension.js +10 -0
  109. package/lib/annotations/condition.ts +2 -4
  110. package/lib/annotations/default-parser.ts +3 -3
  111. package/lib/annotations/extension-point.ts +2 -2
  112. package/lib/annotations/index.ts +1 -1
  113. package/lib/annotations/key.ts +2 -2
  114. package/lib/annotations/label.ts +2 -2
  115. package/lib/annotations/link.ts +2 -2
  116. package/lib/annotations/page-data-provider.ts +2 -3
  117. package/lib/annotations/page-decorator.ts +2 -4
  118. package/lib/annotations/page-title.ts +2 -3
  119. package/lib/annotations/page-url.ts +2 -4
  120. package/lib/annotations/types.ts +4 -4
  121. package/lib/annotations/weight.ts +7 -3
  122. package/lib/atlassian-webresource-webpack-plugin.d.ts +0 -11
  123. package/lib/generator/conditions.ts +4 -3
  124. package/lib/generator/entrypoint.ts +29 -2
  125. package/lib/generator/webfragmentDescriptor.ts +30 -0
  126. package/lib/generator/{webpage-descriptor.ts → webpageDescriptor.ts} +10 -5
  127. package/lib/generator/xml.ts +72 -0
  128. package/lib/runtime/.eslintrc.js +7 -0
  129. package/lib/runtime/extension-entrypoint.js +4 -3
  130. package/lib/runtime/web-page-entrypoint.js +7 -3
  131. package/lib/tests/test-helper.ts +29 -0
  132. package/lib/transform-comment.ts +9 -4
  133. package/lib/types.ts +1 -1
  134. package/lib/utils.ts +24 -1
  135. package/package.json +23 -19
  136. package/tsconfig.all.json +6 -0
  137. package/tsconfig.json +5 -3
  138. package/dist/cjs/generator/webpage-descriptor.js.map +0 -1
  139. package/dist/cjs/generator/webpanel-descriptor.js +0 -22
  140. package/dist/cjs/generator/webpanel-descriptor.js.map +0 -1
  141. package/dist/tsconfig.tsbuildinfo +0 -8282
  142. package/dist/types/generator/webpage-descriptor.d.ts.map +0 -1
  143. package/dist/types/generator/webpanel-descriptor.d.ts +0 -4
  144. package/dist/types/generator/webpanel-descriptor.d.ts.map +0 -1
  145. package/lib/__fixtures__/metadata/$key.extension.js +0 -9
  146. package/lib/__fixtures__/metadata/attributes.extension.js +0 -8
  147. package/lib/__fixtures__/metadata/elements.extension.js +0 -9
  148. package/lib/generator/webpanel-descriptor.ts +0 -27
  149. package/lib/virtual-module-webpack-plugin.d.ts +0 -14
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Webpack plugin
4
4
 
5
- A webpack plugin to faciliate the consumption of client-side extensions using webpack. It will read comment annotations to create the
6
- necesary web-fragments XML declarations for plugin devs.
5
+ A webpack plugin to facilitate the consumption of client-side extensions using webpack. It will read comment annotations to create the
6
+ necessary web-fragments XML declarations for plugin devs.
7
7
 
8
- Refer to the [official documentation](https://developer.atlassian.com/server/framework/clientside-extensions) for more information.
8
+ Refer to the [official webpack plugin documentation](https://developer.atlassian.com/server/framework/clientside-extensions/reference/webpack-plugin/webpack-plugin/)
9
+ for more information.
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
2
  const tslib_1 = require("tslib");
3
- const fs_1 = tslib_1.__importDefault(require("fs"));
4
- const path_1 = tslib_1.__importDefault(require("path"));
5
- // TODO: SFP-157: Remove me once we fix the issue with Pipelines and docker environment that is using Node 10
6
- require("ts-polyfill/lib/es2019-object");
7
- const glob_1 = tslib_1.__importDefault(require("glob"));
8
- const kebabCase_1 = tslib_1.__importDefault(require("lodash/kebabCase"));
3
+ const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
4
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
5
+ const glob_1 = require("glob");
6
+ const kebabCase_1 = (0, tslib_1.__importDefault)(require("lodash/kebabCase"));
9
7
  const pretty_data_1 = require("pretty-data");
10
- const virtual_module_webpack_plugin_1 = tslib_1.__importDefault(require("virtual-module-webpack-plugin"));
11
- const transform_comment_1 = tslib_1.__importDefault(require("./transform-comment"));
12
- const annotations_1 = tslib_1.__importDefault(require("./annotations"));
13
- const webpanel_descriptor_1 = tslib_1.__importDefault(require("./generator/webpanel-descriptor"));
14
- const webpage_descriptor_1 = tslib_1.__importStar(require("./generator/webpage-descriptor"));
8
+ const webpack_virtual_modules_1 = (0, tslib_1.__importDefault)(require("webpack-virtual-modules"));
9
+ const transform_comment_1 = (0, tslib_1.__importDefault)(require("./transform-comment"));
10
+ const annotations_1 = (0, tslib_1.__importDefault)(require("./annotations"));
11
+ const webfragmentDescriptor_1 = (0, tslib_1.__importDefault)(require("./generator/webfragmentDescriptor"));
12
+ const webpageDescriptor_1 = (0, tslib_1.__importStar)(require("./generator/webpageDescriptor"));
15
13
  const entrypoint_1 = require("./generator/entrypoint");
16
14
  const utils_1 = require("./utils");
17
- const conditions_1 = tslib_1.__importDefault(require("./generator/conditions"));
18
- module.exports = class ClientsideExtensionsWebpackPlugin {
15
+ const conditions_1 = (0, tslib_1.__importDefault)(require("./generator/conditions"));
16
+ class ClientsideExtensionsWebpackPlugin {
19
17
  constructor(options = {}) {
20
18
  if (!options.pattern) {
21
19
  throw new Error('No pattern was specified to match clientside extensions');
@@ -23,9 +21,14 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
23
21
  this.outputFilename = options.xmlDescriptors;
24
22
  this.pattern = options.pattern;
25
23
  this.cwd = options.cwd || process.cwd();
26
- this.manifests = ClientsideExtensionsWebpackPlugin.findFilesByPattern(this.pattern, this.cwd)
27
- .map(file => ClientsideExtensionsWebpackPlugin.parseManifestFromComment(file, this.cwd))
28
- .filter(Boolean);
24
+ const ignore = options.ignore || ['**/node_modules/**', 'build/**', 'target/**'];
25
+ (0, utils_1.debugLog)(`cwd: ${this.cwd}`);
26
+ const globFoundFiles = ClientsideExtensionsWebpackPlugin.findFilesByPattern(this.pattern, this.cwd, ignore);
27
+ (0, utils_1.debugLog)(`Glob found (with the pattern: ${this.pattern}) these files: ${globFoundFiles}`);
28
+ this.manifests = globFoundFiles
29
+ .map((file) => ClientsideExtensionsWebpackPlugin.parseManifestFromComment(file, this.cwd))
30
+ .filter(utils_1.isNotNull);
31
+ (0, utils_1.debugLog)(`Found the following manifests ${JSON.stringify(this.manifests)}`);
29
32
  }
30
33
  generateEntrypoints() {
31
34
  return this.manifests.reduce((agg, manifest) => {
@@ -36,7 +39,7 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
36
39
  }
37
40
  apply(compiler) {
38
41
  const wrmOptions = ClientsideExtensionsWebpackPlugin.getWrmWebpackPluginOptions(compiler);
39
- const extensionsOptions = this.manifests.map(manifest => {
42
+ const extensionsOptions = this.manifests.map((manifest) => {
40
43
  return ClientsideExtensionsWebpackPlugin.manifestToPluginOptions(wrmOptions.pluginKey, manifest);
41
44
  });
42
45
  // side effect
@@ -45,29 +48,32 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
45
48
  ClientsideExtensionsWebpackPlugin.addDataProvidersToEntrypoints(extensionsOptions, wrmOptions);
46
49
  // side effect
47
50
  ClientsideExtensionsWebpackPlugin.addConditionToEntrypoint(extensionsOptions, wrmOptions);
48
- extensionsOptions.forEach(extensionOption => {
49
- new virtual_module_webpack_plugin_1.default({
50
- moduleName: ClientsideExtensionsWebpackPlugin.getFilenameForEntry(extensionOption.id),
51
- contents: entrypoint_1.generateEntrypointCode(extensionOption),
52
- }).apply(compiler);
53
- });
54
- compiler.hooks.emit.tapAsync('Generate clientside-extension XML', (compilation, callback) => {
55
- const webpanelDescriptors = extensionsOptions.map(extensionOption => webpanel_descriptor_1.default(extensionOption));
56
- const webpageDescriptors = extensionsOptions.map(extensionOption => webpage_descriptor_1.default(extensionOption));
57
- const descriptors = [...webpanelDescriptors, ...webpageDescriptors].join('');
51
+ const virtualModules = extensionsOptions.reduce((agg, extensionOption) => {
52
+ const fileName = ClientsideExtensionsWebpackPlugin.getFilenameForEntry(extensionOption.id);
53
+ agg[fileName] = (0, entrypoint_1.generateEntrypointCode)(extensionOption);
54
+ return agg;
55
+ }, {});
56
+ new webpack_virtual_modules_1.default(virtualModules).apply(compiler);
57
+ compiler.hooks.compilation.tap('Tap compilation for XML generation', (compilation) => {
58
+ const webfragmentDescriptors = extensionsOptions.map((extensionOption) => (0, webfragmentDescriptor_1.default)(extensionOption));
59
+ const webpageDescriptors = extensionsOptions.map((extensionOption) => (0, webpageDescriptor_1.default)(extensionOption));
60
+ const descriptors = [...webfragmentDescriptors, ...webpageDescriptors].join('');
58
61
  const xmlDescriptors = pretty_data_1.pd.xml(`<clientside-extension>${descriptors}</clientside-extension>`);
59
62
  const xmlDescriptorDirname = path_1.default.dirname(path_1.default.relative(compiler.options.output.path || '', this.outputFilename || wrmOptions.xmlDescriptors));
60
63
  const xmlDescriptorFilename = path_1.default.basename(this.outputFilename || 'wr-generated-clientside-extensions.xml');
61
64
  const webpanelXmlDescriptorFilename = path_1.default.join(xmlDescriptorDirname, xmlDescriptorFilename);
62
- compilation.assets[webpanelXmlDescriptorFilename] = {
63
- source: () => Buffer.from(xmlDescriptors),
64
- size: () => Buffer.byteLength(xmlDescriptors),
65
- };
66
- callback();
65
+ compilation.hooks.additionalAssets.tap('Generate clientside-extension XML', () => {
66
+ compilation.assets[webpanelXmlDescriptorFilename] = {
67
+ source: () => Buffer.from(xmlDescriptors),
68
+ size: () => Buffer.byteLength(xmlDescriptors),
69
+ };
70
+ });
67
71
  });
68
72
  }
69
73
  static addContextToEntrypoints(extensionOptions, wrmOptions) {
70
- extensionOptions.forEach(extensionOption => {
74
+ extensionOptions
75
+ .filter((extensionOption) => !(0, entrypoint_1.isPageExtension)(extensionOption))
76
+ .forEach((extensionOption) => {
71
77
  const { contextMap } = wrmOptions;
72
78
  const entrypointId = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(extensionOption.key);
73
79
  const context = extensionOption.extensionPoint;
@@ -76,26 +82,28 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
76
82
  }
77
83
  static addDataProvidersToEntrypoints(extensionOptions, wrmOptions) {
78
84
  extensionOptions
79
- .filter(extensionOption => Boolean(extensionOption.pageDataProvider))
80
- .forEach(extensionOption => {
85
+ .filter((extensionOption) => Boolean(extensionOption.pageDataProvider))
86
+ .forEach((extensionOption) => {
81
87
  const { dataProvidersMap } = wrmOptions;
82
88
  const entrypointId = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(extensionOption.key);
83
89
  const dataProvider = {
84
- key: webpage_descriptor_1.PAGE_DATA_PROVIDER_DATA_KEY,
90
+ key: webpageDescriptor_1.PAGE_DATA_PROVIDER_DATA_KEY,
85
91
  class: extensionOption.pageDataProvider,
86
92
  };
87
93
  dataProvidersMap.set(entrypointId, [dataProvider]);
88
94
  });
89
95
  }
90
96
  static addConditionToEntrypoint(extensionOptions, wrmOptions) {
97
+ // eslint-disable-next-line @typescript-eslint/no-shadow
91
98
  const hasCondition = (extensionOptions) => Boolean(extensionOptions.condition);
92
- const isNotPageExtension = (extensionOptions) => !entrypoint_1.isPageExtension(extensionOptions);
99
+ // eslint-disable-next-line @typescript-eslint/no-shadow
100
+ const isNotPageExtension = (extensionOptions) => !(0, entrypoint_1.isPageExtension)(extensionOptions);
93
101
  extensionOptions
94
102
  .filter(hasCondition)
95
103
  .filter(isNotPageExtension)
96
- .forEach(extensionOption => {
104
+ .forEach((extensionOption) => {
97
105
  const entrypointId = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(extensionOption.key);
98
- const conditionMap = conditions_1.default(extensionOption.condition);
106
+ const conditionMap = (0, conditions_1.default)(extensionOption.condition);
99
107
  const conditionMapPluginOption = wrmOptions.conditionMap;
100
108
  conditionMapPluginOption.set(entrypointId, conditionMap);
101
109
  });
@@ -106,8 +114,9 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
106
114
  filePath,
107
115
  };
108
116
  const annotations = {};
109
- for (const [annotationKey, annotationParser] of Object.entries(annotations_1.default)) {
110
- const rawAnnotation = utils_1.getKeyValue(rawAnnotations, annotationKey);
117
+ const entries = Object.entries(annotations_1.default);
118
+ for (const [annotationKey, annotationParser] of entries) {
119
+ const rawAnnotation = (0, utils_1.getKeyValue)(rawAnnotations, annotationKey);
111
120
  const newAnnotations = annotationParser(rawAnnotation, rawAnnotations, parserOptions);
112
121
  if (newAnnotations !== null) {
113
122
  Object.assign(annotations, newAnnotations);
@@ -118,30 +127,29 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
118
127
  filePath,
119
128
  ...annotations,
120
129
  };
130
+ (0, utils_1.debugLog)(`Generated manifest: ${JSON.stringify(manifest)}`);
121
131
  return manifest;
122
132
  }
123
133
  static parseManifestFromComment(file, cwd) {
124
134
  const fileContent = fs_1.default.readFileSync(file, 'utf8');
125
- const annotations = transform_comment_1.default(fileContent);
135
+ const annotations = (0, transform_comment_1.default)(fileContent);
126
136
  if (!annotations) {
127
137
  console.warn(`Client-side Extension: The file: "${file}" does not contain meta comments. Skipping XML-descriptor generation.`);
128
138
  return null;
129
139
  }
130
140
  return ClientsideExtensionsWebpackPlugin.transformAnnotationsIntoManifest(annotations, file, cwd);
131
141
  }
132
- static findFilesByPattern(pattern, cwd) {
133
- return glob_1.default.sync(pattern, { absolute: true, cwd });
142
+ static findFilesByPattern(pattern, cwd, ignore) {
143
+ return glob_1.glob.sync(pattern, { absolute: true, cwd, ignore, dotRelative: true });
134
144
  }
135
145
  static getWrmWebpackPluginOptions(compiler) {
136
146
  const { plugins } = compiler.options;
137
147
  if (!plugins) {
138
148
  throw new Error(`Something went mighty wrong. Can't find any plugins in webpack`);
139
149
  }
140
- const wrmPlugin = plugins.find(p => p.constructor.name === 'WrmPlugin');
150
+ const wrmPlugin = plugins.find((p) => p.constructor.name === 'WrmPlugin');
141
151
  if (!wrmPlugin) {
142
- throw new Error(
143
- // eslint-disable-next-line max-len
144
- `Can't find the WrmPlugin. Make sure you are using this plugin only in conjunction with the atlassian-webresource-webpack-plugin`);
152
+ throw new Error(`Can't find the WrmPlugin. Make sure you are using this plugin only in conjunction with the atlassian-webresource-webpack-plugin`);
145
153
  }
146
154
  return wrmPlugin.options;
147
155
  }
@@ -159,7 +167,8 @@ module.exports = class ClientsideExtensionsWebpackPlugin {
159
167
  };
160
168
  }
161
169
  static getIdFromManifestKey(key) {
162
- return kebabCase_1.default(key);
170
+ return (0, kebabCase_1.default)(key);
163
171
  }
164
- };
172
+ }
173
+ module.exports = ClientsideExtensionsWebpackPlugin;
165
174
  //# sourceMappingURL=ClientsideExtensionsWebpackPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientsideExtensionsWebpackPlugin.js","sourceRoot":"","sources":["../../lib/ClientsideExtensionsWebpackPlugin.ts"],"names":[],"mappings":";;AAAA,oDAAoB;AACpB,wDAAwB;AAExB,6GAA6G;AAC7G,yCAAuC;AAGvC,wDAAwB;AACxB,yEAAyC;AACzC,6CAA+C;AAC/C,0GAAgE;AAChE,oFAAmD;AACnD,wEAAyG;AAEzG,kGAAyE;AACzE,6FAAwG;AACxG,uDAAiF;AAGjF,mCAAsC;AAEtC,gFAA4E;AAQ5E,iBAAS,MAAM,iCAAiC;IAS5C,YAAY,UAA8C,EAAE;QACxD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC9E;QAED,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,iCAAiC,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC;aACxF,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,iCAAiC,CAAC,wBAAwB,CAAC,IAAI,EAAE,I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O,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QAE1E,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CACX,iIAAiI,CACpI,CAAC;SACL;QAED,OAAQ,SAAoE,CAAC,OAAO,CAAC;IACzF,CAAC;IAEO,MAAM,CAAC,mBAAmB,CAAC,UAAkB;QACjD,OAAO,oCAAoC,UAAU,KAAK,CAAC;IAC/D,CAAC;IAEO,MAAM,CAAC,uBAAuB,CAAC,SAAiB,EAAE,QAAsC;QAC5F,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;QAC7B,MAAM,WAAW,GAAG,cAAc,EAAE,EAAE,CAAC;QAEvC,OAAO;YACH,GAAG,QAAQ;YACX,SAAS;YACT,UAAU,EAAE,WAAW;YACvB,uBAAuB,EAAE,GAAG,SAAS,IAAI,GAAG,EAAE;SACjD,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,oBAAoB,CAAC,GAAW;QAC3C,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACJ;AAED,iBAAS,iCAAiC,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Compilation, Compiler, WebpackPluginInstance } from 'webpack';\nimport { glob } from 'glob';\nimport kebabCase from 'lodash/kebabCase';\nimport { pd as PrettyData } from 'pretty-data';\nimport VirtualModulePlugin from 'webpack-virtual-modules';\nimport transformComment from './transform-comment';\nimport type { AnnotationKey, AnnotationParserFunction, AnnotationParserOptions, Annotations, RawAnnotations } from './annotations';\nimport annotationsParsers from './annotations';\n\nimport generateWebfragmentDescriptor from './generator/webfragmentDescriptor';\nimport generateWebpageDescriptor, { PAGE_DATA_PROVIDER_DATA_KEY } from './generator/webpageDescriptor';\nimport { generateEntrypointCode, isPageExtension } from './generator/entrypoint';\n\nimport type { ClientsideExtensionsManifest, ClientsideExtensionsOptions, DataProvider, IWrmPluginOptions } from './types';\nimport { debugLog, getKeyValue, isNotNull } from './utils';\n\nimport transformConditionToConditionMapObject from './generator/conditions';\n\n// Infer the type \"Source\" which is not exposed by Webpack\ntype Asset = Compilation['assets'] extends Record<string, infer S> ? S : never;\n\ninterface IClientsideExtensionsPluginOptions {\n pattern?: string;\n cwd?: string;\n xmlDescriptors?: string;\n ignore?: string[];\n}\n\nclass ClientsideExtensionsWebpackPlugin {\n private readonly pattern: string;\n\n private readonly cwd: string;\n\n private readonly outputFilename?: string;\n\n private manifests: ClientsideExtensionsManifest[];\n\n constructor(options: IClientsideExtensionsPluginOptions = {}) {\n if (!options.pattern) {\n throw new Error('No pattern was specified to match clientside extensions');\n }\n\n this.outputFilename = options.xmlDescriptors;\n this.pattern = options.pattern;\n this.cwd = options.cwd || process.cwd();\n const ignore = options.ignore || ['**/node_modules/**', 'build/**', 'target/**'];\n\n debugLog(`cwd: ${this.cwd}`);\n\n const globFoundFiles = ClientsideExtensionsWebpackPlugin.findFilesByPattern(this.pattern, this.cwd, ignore);\n\n debugLog(`Glob found (with the pattern: ${this.pattern}) these files: ${globFoundFiles}`);\n\n this.manifests = globFoundFiles\n .map((file) => ClientsideExtensionsWebpackPlugin.parseManifestFromComment(file, this.cwd))\n .filter(isNotNull);\n\n debugLog(`Found the following manifests ${JSON.stringify(this.manifests)}`);\n }\n\n public generateEntrypoints() {\n return this.manifests.reduce((agg, manifest) => {\n const id = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(manifest.key);\n agg[id] = ClientsideExtensionsWebpackPlugin.getFilenameForEntry(id);\n\n return agg;\n }, {} as { [key: string]: string });\n }\n\n apply(compiler: Compiler) {\n const wrmOptions = ClientsideExtensionsWebpackPlugin.getWrmWebpackPluginOptions(compiler);\n\n const extensionsOptions = this.manifests.map((manifest) => {\n return ClientsideExtensionsWebpackPlugin.manifestToPluginOptions(wrmOptions.pluginKey, manifest);\n });\n\n // side effect\n ClientsideExtensionsWebpackPlugin.addContextToEntrypoints(extensionsOptions, wrmOptions);\n\n // side effect\n ClientsideExtensionsWebpackPlugin.addDataProvidersToEntrypoints(extensionsOptions, wrmOptions);\n\n // side effect\n ClientsideExtensionsWebpackPlugin.addConditionToEntrypoint(extensionsOptions, wrmOptions);\n\n const virtualModules = extensionsOptions.reduce((agg, extensionOption) => {\n const fileName = ClientsideExtensionsWebpackPlugin.getFilenameForEntry(extensionOption.id);\n agg[fileName] = generateEntrypointCode(extensionOption);\n return agg;\n }, {} as Record<string, string>);\n new VirtualModulePlugin(virtualModules).apply(compiler);\n\n compiler.hooks.compilation.tap('Tap compilation for XML generation', (compilation) => {\n const webfragmentDescriptors = extensionsOptions.map((extensionOption) => generateWebfragmentDescriptor(extensionOption));\n const webpageDescriptors = extensionsOptions.map((extensionOption) => generateWebpageDescriptor(extensionOption));\n\n const descriptors = [...webfragmentDescriptors, ...webpageDescriptors].join('');\n const xmlDescriptors = PrettyData.xml(`<clientside-extension>${descriptors}</clientside-extension>`);\n\n const xmlDescriptorDirname = path.dirname(\n path.relative(compiler.options.output.path || '', this.outputFilename || wrmOptions.xmlDescriptors),\n );\n const xmlDescriptorFilename = path.basename(this.outputFilename || 'wr-generated-clientside-extensions.xml');\n const webpanelXmlDescriptorFilename = path.join(xmlDescriptorDirname, xmlDescriptorFilename);\n\n compilation.hooks.additionalAssets.tap('Generate clientside-extension XML', () => {\n compilation.assets[webpanelXmlDescriptorFilename] = {\n source: () => Buffer.from(xmlDescriptors),\n size: () => Buffer.byteLength(xmlDescriptors),\n } as Asset;\n });\n });\n }\n\n private static addContextToEntrypoints(extensionOptions: ClientsideExtensionsOptions[], wrmOptions: IWrmPluginOptions) {\n extensionOptions\n .filter((extensionOption) => !isPageExtension(extensionOption))\n .forEach((extensionOption) => {\n const { contextMap } = wrmOptions;\n const entrypointId = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(extensionOption.key);\n const context = extensionOption.extensionPoint;\n\n contextMap.set(entrypointId, [context]);\n });\n }\n\n private static addDataProvidersToEntrypoints(extensionOptions: ClientsideExtensionsOptions[], wrmOptions: IWrmPluginOptions) {\n extensionOptions\n .filter((extensionOption) => Boolean(extensionOption.pageDataProvider))\n .forEach((extensionOption) => {\n const { dataProvidersMap } = wrmOptions;\n const entrypointId = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(extensionOption.key);\n const dataProvider: DataProvider = {\n key: PAGE_DATA_PROVIDER_DATA_KEY,\n class: extensionOption.pageDataProvider!,\n };\n\n dataProvidersMap.set(entrypointId, [dataProvider]);\n });\n }\n\n private static addConditionToEntrypoint(extensionOptions: ClientsideExtensionsOptions[], wrmOptions: IWrmPluginOptions) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hasCondition = (extensionOptions: ClientsideExtensionsOptions) => Boolean(extensionOptions.condition);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const isNotPageExtension = (extensionOptions: ClientsideExtensionsOptions) => !isPageExtension(extensionOptions);\n\n extensionOptions\n .filter(hasCondition)\n .filter(isNotPageExtension)\n .forEach((extensionOption) => {\n const entrypointId = ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(extensionOption.key);\n const conditionMap = transformConditionToConditionMapObject(extensionOption.condition!);\n\n const conditionMapPluginOption = wrmOptions.conditionMap as Map<string, object>;\n\n conditionMapPluginOption.set(entrypointId, conditionMap);\n });\n }\n\n private static transformAnnotationsIntoManifest(\n rawAnnotations: RawAnnotations,\n filePath: string,\n cwd: string,\n ): ClientsideExtensionsManifest {\n const parserOptions: AnnotationParserOptions = {\n cwd,\n filePath,\n };\n\n const annotations = {} as Annotations;\n const entries = Object.entries(annotationsParsers) as [[AnnotationKey, AnnotationParserFunction]];\n\n for (const [annotationKey, annotationParser] of entries) {\n const rawAnnotation = getKeyValue(rawAnnotations, annotationKey);\n const newAnnotations = annotationParser(rawAnnotation, rawAnnotations, parserOptions);\n\n if (newAnnotations !== null) {\n Object.assign(annotations, newAnnotations);\n }\n }\n\n const manifest: ClientsideExtensionsManifest = {\n id: ClientsideExtensionsWebpackPlugin.getIdFromManifestKey(annotations.key),\n filePath,\n ...annotations,\n };\n\n debugLog(`Generated manifest: ${JSON.stringify(manifest)}`);\n\n return manifest;\n }\n\n private static parseManifestFromComment(file: string, cwd: string): ClientsideExtensionsManifest | null {\n const fileContent = fs.readFileSync(file, 'utf8');\n const annotations = transformComment(fileContent);\n\n if (!annotations) {\n console.warn(`Client-side Extension: The file: \"${file}\" does not contain meta comments. Skipping XML-descriptor generation.`);\n return null;\n }\n\n return ClientsideExtensionsWebpackPlugin.transformAnnotationsIntoManifest(annotations, file, cwd);\n }\n\n private static findFilesByPattern(pattern: string, cwd: string, ignore?: string[]) {\n return glob.sync(pattern, { absolute: true, cwd, ignore, dotRelative: true });\n }\n\n private static getWrmWebpackPluginOptions(compiler: Compiler): IWrmPluginOptions {\n const { plugins } = compiler.options;\n if (!plugins) {\n throw new Error(`Something went mighty wrong. Can't find any plugins in webpack`);\n }\n const wrmPlugin = plugins.find((p) => p.constructor.name === 'WrmPlugin');\n\n if (!wrmPlugin) {\n throw new Error(\n `Can't find the WrmPlugin. Make sure you are using this plugin only in conjunction with the atlassian-webresource-webpack-plugin`,\n );\n }\n\n return (wrmPlugin as WebpackPluginInstance & { options: IWrmPluginOptions }).options;\n }\n\n private static getFilenameForEntry(manifestId: string) {\n return `./generated-clientside-extension/${manifestId}.js`;\n }\n\n private static manifestToPluginOptions(pluginKey: string, manifest: ClientsideExtensionsManifest): ClientsideExtensionsOptions {\n const { id, key } = manifest;\n const resourceKey = `entrypoint-${id}`;\n\n return {\n ...manifest,\n pluginKey,\n entryPoint: resourceKey,\n fullyQualifiedNamespace: `${pluginKey}:${key}`,\n };\n }\n\n private static getIdFromManifestKey(key: string) {\n return kebabCase(key);\n }\n}\n\nexport = ClientsideExtensionsWebpackPlugin;\n"]}
@@ -3,15 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ANNOTATION_KEY = 'condition';
4
4
  const parseConditionComment = (conditionComment, filePath) => {
5
5
  if (!conditionComment) {
6
- throw new Error(
7
- // eslint-disable-next-line max-len
8
- `Client-side Extensions: Empty condition specified in file ${filePath}. Please ensure to specify a valid condition class or remove the @${ANNOTATION_KEY} annotation`);
6
+ throw new Error(`Client-side Extensions: Empty condition specified in file ${filePath}. Please ensure to specify a valid condition class or remove the @${ANNOTATION_KEY} annotation`);
9
7
  }
10
8
  const found = conditionComment.match(/([^\s]+)\s(.+)/);
11
9
  if (found === null) {
12
- throw new Error(
13
- // eslint-disable-next-line max-len
14
- `Client-side Extensions: Invalid condition specified in file ${filePath}. Please verify the @${ANNOTATION_KEY} annotation`);
10
+ throw new Error(`Client-side Extensions: Invalid condition specified in file ${filePath}. Please verify the @${ANNOTATION_KEY} annotation`);
15
11
  }
16
12
  const [, path, value] = found;
17
13
  return { path, value };
@@ -1 +1 @@
1
- {"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../lib/annotations/condition.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAkB,WAAW,CAAC;AAElD,MAAM,qBAAqB,GAAG,CAAC,gBAAwB,EAAE,QAAgB,EAAE,EAAE;IACzE,IAAI,CAAC,gBAAgB,EAAE;QACnB,MAAM,IAAI,KAAK;QACX,mCAAmC;QACnC,6DAA6D,QAAQ,qEAAqE,cAAc,aAAa,CACxK,CAAC;KACL;IAED,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEvD,IAAI,KAAK,KAAK,IAAI,EAAE;QAChB,MAAM,IAAI,KAAK;QACX,mCAAmC;QACnC,+DAA+D,QAAQ,wBAAwB,cAAc,aAAa,CAC7H,CAAC;KACL;IAED,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;IAC9B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,eAAe,GAA6B,CAAC,QAAkB,EAAE,cAAc,EAA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E,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,MAAM,YAAY,GAAG,EAAkB,CAAC;IAExC,KAAK,MAAM,gBAAgB,IAAI,QAAQ,EAAE;QACrC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAE1E,YAAY,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;KAC9B;IAED,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,YAAY;KACjC,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction, ConditionMap } from './types';\n\nconst ANNOTATION_KEY: AnnotationKey = 'condition';\n\nconst parseConditionComment = (conditionComment: string, filePath: string) => {\n if (!conditionComment) {\n throw new Error(\n `Client-side Extensions: Empty condition specified in file ${filePath}. Please ensure to specify a valid condition class or remove the @${ANNOTATION_KEY} annotation`,\n );\n }\n\n const found = conditionComment.match(/([^\\s]+)\\s(.+)/);\n\n if (found === null) {\n throw new Error(\n `Client-side Extensions: Invalid condition specified in file ${filePath}. Please verify the @${ANNOTATION_KEY} annotation`,\n );\n }\n\n const [, path, value] = found;\n return { path, value };\n};\n\nconst conditionParser: AnnotationParserFunction<string[]> = (rawValue, rawAnnotations, options) => {\n if (!rawValue) {\n return null;\n }\n\n const { filePath } = options;\n\n const conditionMap = {} as ConditionMap;\n\n for (const conditionComment of rawValue) {\n const { path, value } = parseConditionComment(conditionComment, filePath);\n\n conditionMap[path] = value;\n }\n\n return {\n [ANNOTATION_KEY]: conditionMap,\n };\n};\n\nexport default conditionParser;\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const getDefaultParser = (annotationKey) => {
4
- const defaultParser = rawValue => {
4
+ const defaultParser = (rawValue) => {
5
5
  if (!rawValue) {
6
6
  return null;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"default-parser.js","sourceRoot":"","sources":["../../../lib/annotations/default-parser.ts"],"names":[],"mappings":";;AAEA,MAAM,gBAAgB,GAAG,CAAC,aAA4B,EAAE,EAAE;IACtD,MAAM,aAAa,GAA6B,QAAQ,CAAC,EAAE;QACvD,IAAI,CAAC,QAAQ,EAAE;YACX,OAAO,IAAI,CAAC;SACf;QAED,OAAO;YACH,CAAC,aAAa,CAAC,EAAE,QAAQ;SAC5B,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"default-parser.js","sourceRoot":"","sources":["../../../lib/annotations/default-parser.ts"],"names":[],"mappings":";;AAEA,MAAM,gBAAgB,GAAG,CAAI,aAA4B,EAAE,EAAE;IACzD,MAAM,aAAa,GAAgC,CAAC,QAAQ,EAAE,EAAE;QAC5D,IAAI,CAAC,QAAQ,EAAE;YACX,OAAO,IAAI,CAAC;SACf;QAED,OAAO;YACH,CAAC,aAAa,CAAC,EAAE,QAAQ;SAC5B,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction } from './types';\n\nconst getDefaultParser = <T>(annotationKey: AnnotationKey) => {\n const defaultParser: AnnotationParserFunction<T> = (rawValue) => {\n if (!rawValue) {\n return null;\n }\n\n return {\n [annotationKey]: rawValue,\n };\n };\n\n return defaultParser;\n};\n\nexport default getDefaultParser;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"extension-point.js","sourceRoot":"","sources":["../../../lib/annotations/extension-point.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAkB,gBAAgB,CAAC;AAEvD,MAAM,oBAAoB,GAA6B,CAAC,KAAa,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC9F,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,KAAK,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,+BAA+B,cAAc,aAAa,QAAQ,+BAA+B,CAAC,CAAC;KACtH;IAED,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,KAAK;KAC1B,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"extension-point.js","sourceRoot":"","sources":["../../../lib/annotations/extension-point.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAkB,gBAAgB,CAAC;AAEvD,MAAM,oBAAoB,GAAqC,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC9F,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,KAAK,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,+BAA+B,cAAc,aAAa,QAAQ,+BAA+B,CAAC,CAAC;KACtH;IAED,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,KAAK;KAC1B,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction } from './types';\n\nconst ANNOTATION_KEY: AnnotationKey = 'extensionPoint';\n\nconst extensionPointParser: AnnotationParserFunction<string> = (value, rawAnnotations, options) => {\n const { filePath } = options;\n\n if (!value) {\n throw new Error(`Client-side Extension: The @${ANNOTATION_KEY} in file \"${filePath}\" requires a non-empty value.`);\n }\n\n return {\n [ANNOTATION_KEY]: value,\n };\n};\n\nexport default extensionPointParser;\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const parsers = tslib_1.__importStar(require("./parsers"));
5
- tslib_1.__exportStar(require("./types"), exports);
4
+ const parsers = (0, tslib_1.__importStar)(require("./parsers"));
5
+ (0, tslib_1.__exportStar)(require("./types"), exports);
6
6
  exports.default = parsers;
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/annotations/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqC;AAGrC,kDAAwB;AAExB,kBAAe,OAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/annotations/index.ts"],"names":[],"mappings":";;;AAAA,gEAAqC;AAGrC,uDAAwB;AAExB,kBAAe,OAA4B,CAAC","sourcesContent":["import * as parsers from './parsers';\nimport type { AnnotationParsers } from './types';\n\nexport * from './types';\n\nexport default parsers as AnnotationParsers;\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const path_1 = tslib_1.__importDefault(require("path"));
4
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
5
5
  const ANNOTATION_KEY = 'key';
6
6
  const keyParser = (rawValue, rawAnnotations, options) => {
7
7
  let key;
@@ -1 +1 @@
1
- {"version":3,"file":"key.js","sourceRoot":"","sources":["../../../lib/annotations/key.ts"],"names":[],"mappings":";;;AAAA,wDAAwB;AAGxB,MAAM,cAAc,GAAkB,KAAK,CAAC;AAE5C,MAAM,SAAS,GAA6B,CAAC,QAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IACtF,IAAI,GAAW,CAAC;IAEhB,IAAI,QAAQ,EAAE;QACV,GAAG,GAAG,QAAQ,CAAC;KAClB;SAAM;QACH,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAClC,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;KACtC;IAED,sFAAsF;IACtF,4DAA4D;IAC5D,MAAM,MAAM,GAAG,iBAAiB,CAAC;IAEjC,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;KAC9C,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"key.js","sourceRoot":"","sources":["../../../lib/annotations/key.ts"],"names":[],"mappings":";;;AAAA,6DAAwB;AAGxB,MAAM,cAAc,GAAkB,KAAK,CAAC;AAE5C,MAAM,SAAS,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IACtF,IAAI,GAAW,CAAC;IAEhB,IAAI,QAAQ,EAAE;QACV,GAAG,GAAG,QAAQ,CAAC;KAClB;SAAM;QACH,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAClC,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;KACtC;IAED,sFAAsF;IACtF,4DAA4D;IAC5D,MAAM,MAAM,GAAG,iBAAiB,CAAC;IAEjC,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;KAC9C,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["import path from 'path';\nimport type { AnnotationKey, AnnotationParserFunction } from './types';\n\nconst ANNOTATION_KEY: AnnotationKey = 'key';\n\nconst keyParser: AnnotationParserFunction<string> = (rawValue, rawAnnotations, options) => {\n let key: string;\n\n if (rawValue) {\n key = rawValue;\n } else {\n const { cwd, filePath } = options;\n key = path.relative(cwd, filePath);\n }\n\n // Sanitize the key to keep only the alphanumeric characters, dashes, and underscores.\n // Keep the $ char since \"$key\" value is a reserved keyword.\n const regExp = /[^a-z0-9$_-]+/gi;\n\n return {\n [ANNOTATION_KEY]: key.replace(regExp, '__'),\n };\n};\n\nexport default keyParser;\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ANNOTATION_KEY = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const default_parser_1 = tslib_1.__importDefault(require("./default-parser"));
5
+ const default_parser_1 = (0, tslib_1.__importDefault)(require("./default-parser"));
6
6
  exports.ANNOTATION_KEY = 'label';
7
- exports.default = default_parser_1.default(exports.ANNOTATION_KEY);
7
+ exports.default = (0, default_parser_1.default)(exports.ANNOTATION_KEY);
8
8
  //# sourceMappingURL=label.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../lib/annotations/label.ts"],"names":[],"mappings":";;;;AAAA,8EAAgD;AAGnC,QAAA,cAAc,GAAkB,OAAO,CAAC;AAErD,kBAAe,wBAAgB,CAAC,sBAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../lib/annotations/label.ts"],"names":[],"mappings":";;;;AAAA,mFAAgD;AAGnC,QAAA,cAAc,GAAkB,OAAO,CAAC;AAErD,kBAAe,IAAA,wBAAgB,EAAS,sBAAc,CAAC,CAAC","sourcesContent":["import getDefaultParser from './default-parser';\nimport type { AnnotationKey } from './types';\n\nexport const ANNOTATION_KEY: AnnotationKey = 'label';\n\nexport default getDefaultParser<string>(ANNOTATION_KEY);\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ANNOTATION_KEY = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const default_parser_1 = tslib_1.__importDefault(require("./default-parser"));
5
+ const default_parser_1 = (0, tslib_1.__importDefault)(require("./default-parser"));
6
6
  exports.ANNOTATION_KEY = 'link';
7
- exports.default = default_parser_1.default(exports.ANNOTATION_KEY);
7
+ exports.default = (0, default_parser_1.default)(exports.ANNOTATION_KEY);
8
8
  //# sourceMappingURL=link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../lib/annotations/link.ts"],"names":[],"mappings":";;;;AAAA,8EAAgD;AAGnC,QAAA,cAAc,GAAmC,MAAM,CAAC;AAErE,kBAAe,wBAAgB,CAAC,sBAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../lib/annotations/link.ts"],"names":[],"mappings":";;;;AAAA,mFAAgD;AAGnC,QAAA,cAAc,GAAmC,MAAM,CAAC;AAErE,kBAAe,IAAA,wBAAgB,EAAS,sBAAc,CAAC,CAAC","sourcesContent":["import getDefaultParser from './default-parser';\nimport type { AnnotationKey } from './types';\n\nexport const ANNOTATION_KEY: Extract<AnnotationKey, 'link'> = 'link';\n\nexport default getDefaultParser<string>(ANNOTATION_KEY);\n"]}
@@ -8,9 +8,7 @@ const pageDataProviderParser = (rawValue, rawAnnotations, options) => {
8
8
  }
9
9
  const { filePath } = options;
10
10
  if (!(page_url_1.ANNOTATION_KEY in rawAnnotations)) {
11
- throw new Error(
12
- // eslint-disable-next-line max-len
13
- `Client-side Extension: The @${ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${page_url_1.ANNOTATION_KEY} annotation. Please add the missing @${page_url_1.ANNOTATION_KEY} annotation to your extension.`);
11
+ throw new Error(`Client-side Extension: The @${ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${page_url_1.ANNOTATION_KEY} annotation. Please add the missing @${page_url_1.ANNOTATION_KEY} annotation to your extension.`);
14
12
  }
15
13
  const pageDataProvider = rawValue;
16
14
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"page-data-provider.js","sourceRoot":"","sources":["../../../lib/annotations/page-data-provider.ts"],"names":[],"mappings":";;AACA,yCAAuE;AAEvE,MAAM,cAAc,GAAkB,kBAAkB,CAAC;AAEzD,MAAM,sBAAsB,GAA6B,CAAC,QAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IACnG,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE;QAC9C,MAAM,IAAI,KAAK;QACX,mCAAmC;QACnC,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;KACL;IAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAElC,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,gBAAgB;KACrC,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"page-data-provider.js","sourceRoot":"","sources":["../../../lib/annotations/page-data-provider.ts"],"names":[],"mappings":";;AACA,yCAAuE;AAEvE,MAAM,cAAc,GAAkB,kBAAkB,CAAC;AAEzD,MAAM,sBAAsB,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IACnG,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE;QAC9C,MAAM,IAAI,KAAK,CACX,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;KACL;IAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAElC,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,gBAAgB;KACrC,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,sBAAsB,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction } from './types';\nimport { ANNOTATION_KEY as PAGE_URL_ANNOTATION_KEY } from './page-url';\n\nconst ANNOTATION_KEY: AnnotationKey = 'pageDataProvider';\n\nconst pageDataProviderParser: AnnotationParserFunction<string> = (rawValue, rawAnnotations, options) => {\n if (!rawValue) {\n return null;\n }\n\n const { filePath } = options;\n\n if (!(PAGE_URL_ANNOTATION_KEY in rawAnnotations)) {\n throw new Error(\n `Client-side Extension: The @${ANNOTATION_KEY} annotation in file \"${filePath}\" requires the usage of @${PAGE_URL_ANNOTATION_KEY} annotation. Please add the missing @${PAGE_URL_ANNOTATION_KEY} annotation to your extension.`,\n );\n }\n\n const pageDataProvider = rawValue;\n\n return {\n [ANNOTATION_KEY]: pageDataProvider,\n };\n};\n\nexport default pageDataProviderParser;\n"]}
@@ -10,15 +10,11 @@ const pageDecoratorParser = (rawValue, rawAnnotations, options) => {
10
10
  }
11
11
  const { filePath } = options;
12
12
  if (!(page_url_1.ANNOTATION_KEY in rawAnnotations)) {
13
- throw new Error(
14
- // eslint-disable-next-line max-len
15
- `Client-side Extension: The @${ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${page_url_1.ANNOTATION_KEY} annotation. Please add the missing @${page_url_1.ANNOTATION_KEY} annotation to your extension.`);
13
+ throw new Error(`Client-side Extension: The @${ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${page_url_1.ANNOTATION_KEY} annotation. Please add the missing @${page_url_1.ANNOTATION_KEY} annotation to your extension.`);
16
14
  }
17
15
  const pageDecorator = rawValue;
18
16
  if (!standardPageDecorators.includes(pageDecorator)) {
19
- console.warn(
20
- // eslint-disable-next-line max-len
21
- `The provided value of page decorator "${pageDecorator}" in file "${filePath}" is not a standard decorator. Please ensure you want to use a custom page decorator.\n\nPlease check the documentation page: ${standardPageDecoratorsHelpUrl}`);
17
+ console.warn(`The provided value of page decorator "${pageDecorator}" in file "${filePath}" is not a standard decorator. Please ensure you want to use a custom page decorator.\n\nPlease check the documentation page: ${standardPageDecoratorsHelpUrl}`);
22
18
  }
23
19
  return {
24
20
  [ANNOTATION_KEY]: pageDecorator,
@@ -1 +1 @@
1
- {"version":3,"file":"page-decorator.js","sourceRoot":"","sources":["../../../lib/annotations/page-decorator.ts"],"names":[],"mappings":";;AACA,yCAAuE;AAEvE,MAAM,cAAc,GAAkB,eAAe,CAAC;AAEtD,MAAM,sBAAsB,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;AAC5F,MAAM,6BAA6B,GAAG,+FAA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,KAAK,CACX,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;KACL;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC;IAE/B,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,aAAuB,CAAC,EAAE;QAC3D,OAAO,CAAC,IAAI,CACR,yCAAyC,aAAa,cAAc,QAAQ,iIAAiI,6BAA6B,EAAE,CAC/O,CAAC;KACL;IAED,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,aAAa;KAClC,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,mBAAmB,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction } from './types';\nimport { ANNOTATION_KEY as PAGE_URL_ANNOTATION_KEY } from './page-url';\n\nconst ANNOTATION_KEY: AnnotationKey = 'pageDecorator';\n\nconst standardPageDecorators = ['atl.admin', 'atl.general', 'atl.popup', 'atl.userprofile'];\nconst standardPageDecoratorsHelpUrl = 'https://developer.atlassian.com/server/framework/atlassian-sdk/using-standard-page-decorators';\n\nconst pageDecoratorParser: AnnotationParserFunction<string> = (rawValue, rawAnnotations, options) => {\n if (!rawValue) {\n return null;\n }\n\n const { filePath } = options;\n\n if (!(PAGE_URL_ANNOTATION_KEY in rawAnnotations)) {\n throw new Error(\n `Client-side Extension: The @${ANNOTATION_KEY} annotation in file \"${filePath}\" requires the usage of @${PAGE_URL_ANNOTATION_KEY} annotation. Please add the missing @${PAGE_URL_ANNOTATION_KEY} annotation to your extension.`,\n );\n }\n\n const pageDecorator = rawValue;\n\n if (!standardPageDecorators.includes(pageDecorator as string)) {\n console.warn(\n `The provided value of page decorator \"${pageDecorator}\" in file \"${filePath}\" is not a standard decorator. Please ensure you want to use a custom page decorator.\\n\\nPlease check the documentation page: ${standardPageDecoratorsHelpUrl}`,\n );\n }\n\n return {\n [ANNOTATION_KEY]: pageDecorator,\n };\n};\n\nexport default pageDecoratorParser;\n"]}
@@ -8,9 +8,7 @@ const pageTitleParser = (rawValue, rawAnnotations, options) => {
8
8
  }
9
9
  if (!(page_url_1.ANNOTATION_KEY in rawAnnotations)) {
10
10
  const { filePath } = options;
11
- throw new Error(
12
- // eslint-disable-next-line max-len
13
- `Client-side Extension: The @${ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${page_url_1.ANNOTATION_KEY} annotation. Please add the missing @${page_url_1.ANNOTATION_KEY} annotation to your extension.`);
11
+ throw new Error(`Client-side Extension: The @${ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${page_url_1.ANNOTATION_KEY} annotation. Please add the missing @${page_url_1.ANNOTATION_KEY} annotation to your extension.`);
14
12
  }
15
13
  const pageDecorator = rawValue;
16
14
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"page-title.js","sourceRoot":"","sources":["../../../lib/annotations/page-title.ts"],"names":[],"mappings":";;AACA,yCAAuE;AAEvE,MAAM,cAAc,GAAkB,WAAW,CAAC;AAElD,MAAM,eAAe,GAA6B,CAAC,QAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC5F,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE;QAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7B,MAAM,IAAI,KAAK;QACX,mCAAmC;QACnC,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;KACL;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC;IAE/B,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,aAAa;KAClC,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"page-title.js","sourceRoot":"","sources":["../../../lib/annotations/page-title.ts"],"names":[],"mappings":";;AACA,yCAAuE;AAEvE,MAAM,cAAc,GAAkB,WAAW,CAAC;AAElD,MAAM,eAAe,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC5F,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE;QAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7B,MAAM,IAAI,KAAK,CACX,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;KACL;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC;IAE/B,OAAO;QACH,CAAC,cAAc,CAAC,EAAE,aAAa;KAClC,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction } from './types';\nimport { ANNOTATION_KEY as PAGE_URL_ANNOTATION_KEY } from './page-url';\n\nconst ANNOTATION_KEY: AnnotationKey = 'pageTitle';\n\nconst pageTitleParser: AnnotationParserFunction<string> = (rawValue, rawAnnotations, options) => {\n if (!rawValue) {\n return null;\n }\n\n if (!(PAGE_URL_ANNOTATION_KEY in rawAnnotations)) {\n const { filePath } = options;\n\n throw new Error(\n `Client-side Extension: The @${ANNOTATION_KEY} annotation in file \"${filePath}\" requires the usage of @${PAGE_URL_ANNOTATION_KEY} annotation. Please add the missing @${PAGE_URL_ANNOTATION_KEY} annotation to your extension.`,\n );\n }\n\n const pageDecorator = rawValue;\n\n return {\n [ANNOTATION_KEY]: pageDecorator,\n };\n};\n\nexport default pageTitleParser;\n"]}
@@ -17,14 +17,10 @@ const pageUrlParser = (rawValue, rawAnnotations, options) => {
17
17
  };
18
18
  const { filePath } = options;
19
19
  if (!(label_1.ANNOTATION_KEY in rawAnnotations)) {
20
- throw new Error(
21
- // eslint-disable-next-line max-len
22
- `Client-side Extension: The @${exports.ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${label_1.ANNOTATION_KEY} annotation. Please add the missing @${label_1.ANNOTATION_KEY} annotation to your extension.`);
20
+ throw new Error(`Client-side Extension: The @${exports.ANNOTATION_KEY} annotation in file "${filePath}" requires the usage of @${label_1.ANNOTATION_KEY} annotation. Please add the missing @${label_1.ANNOTATION_KEY} annotation to your extension.`);
23
21
  }
24
22
  if (link_1.ANNOTATION_KEY in rawAnnotations) {
25
- console.warn(
26
- // eslint-disable-next-line max-len
27
- `Client-side Extension: The provided @${link_1.ANNOTATION_KEY} annotation in file "${filePath}" will overwrite the default page URL. Please ensure you want to have a custom URL link.`);
23
+ console.warn(`Client-side Extension: The provided @${link_1.ANNOTATION_KEY} annotation in file "${filePath}" will overwrite the default page URL. Please ensure you want to have a custom URL link.`);
28
24
  return annotations;
29
25
  }
30
26
  const linkValue = generatePageLink(rawValue);
@@ -1 +1 @@
1
- {"version":3,"file":"page-url.js","sourceRoot":"","sources":["../../../lib/annotations/page-url.ts"],"names":[],"mappings":";;;AACA,iCAA+D;AAC/D,mCAAiE;AAEpD,QAAA,cAAc,GAAkB,SAAS,CAAC;AAEvD,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE;IACzC,OAAO,oBAAoB,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF,MAAM,aAAa,GAA6B,CAAC,QAAgB,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC1F,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,MAAM,WAAW,GAAG;QAChB,CAAC,sBAAc,CAAC,EAAE,QAAQ;KACL,CAAC;IAC1B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,CAAC,sBAAoB,IAAI,cAAc,CAAC,EAAE;QAC3C,MAAM,IAAI,KAAK;QACX,mCAAmC;QACnC,+BAA+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,EAAE;QACvC,OAAO,CAAC,IAAI,CACR,wCAAwC,qBAAmB,wBAAwB,QAAQ,0FAA0F,CACxL,CAAC;QAEF,OAAO,WAAW,CAAC;KACtB;IAED,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE7C,WAAW,CAAC,qBAAmB,CAAC,GAAG,SAAS,CAAC;IAE7C,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction, Annotations } from './types';\nimport { ANNOTATION_KEY as LINK_ANNOTATION_KEY } from './link';\nimport { ANNOTATION_KEY as LABEL_ANNOTATION_KEY } from './label';\n\nexport const ANNOTATION_KEY: AnnotationKey = 'pageUrl';\n\nconst LEFT_SLASH_REGEX = /^\\//;\n\nconst generatePageLink = (pageUrl: string) => {\n return `/plugins/servlet/${pageUrl.replace(LEFT_SLASH_REGEX, '')}`;\n};\n\nconst pageUrlParser: AnnotationParserFunction<string> = (rawValue, rawAnnotations, options) => {\n if (!rawValue) {\n return null;\n }\n\n const annotations = {\n [ANNOTATION_KEY]: rawValue,\n } as Partial<Annotations>;\n const { filePath } = options;\n\n if (!(LABEL_ANNOTATION_KEY in rawAnnotations)) {\n throw new Error(\n `Client-side Extension: The @${ANNOTATION_KEY} annotation in file \"${filePath}\" requires the usage of @${LABEL_ANNOTATION_KEY} annotation. Please add the missing @${LABEL_ANNOTATION_KEY} annotation to your extension.`,\n );\n }\n\n if (LINK_ANNOTATION_KEY in rawAnnotations) {\n console.warn(\n `Client-side Extension: The provided @${LINK_ANNOTATION_KEY} annotation in file \"${filePath}\" will overwrite the default page URL. Please ensure you want to have a custom URL link.`,\n );\n\n return annotations;\n }\n\n const linkValue = generatePageLink(rawValue);\n\n annotations[LINK_ANNOTATION_KEY] = linkValue;\n\n return annotations;\n};\n\nexport default pageUrlParser;\n"]}
@@ -1,23 +1,27 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.weight = exports.pageUrl = exports.pageTitle = exports.pageDecorator = exports.link = exports.label = exports.key = exports.extensionPoint = exports.pageDataProvider = exports.condition = void 0;
3
7
  var condition_1 = require("./condition");
4
- Object.defineProperty(exports, "condition", { enumerable: true, get: function () { return condition_1.default; } });
8
+ Object.defineProperty(exports, "condition", { enumerable: true, get: function () { return __importDefault(condition_1).default; } });
5
9
  var page_data_provider_1 = require("./page-data-provider");
6
- Object.defineProperty(exports, "pageDataProvider", { enumerable: true, get: function () { return page_data_provider_1.default; } });
10
+ Object.defineProperty(exports, "pageDataProvider", { enumerable: true, get: function () { return __importDefault(page_data_provider_1).default; } });
7
11
  var extension_point_1 = require("./extension-point");
8
- Object.defineProperty(exports, "extensionPoint", { enumerable: true, get: function () { return extension_point_1.default; } });
12
+ Object.defineProperty(exports, "extensionPoint", { enumerable: true, get: function () { return __importDefault(extension_point_1).default; } });
9
13
  var key_1 = require("./key");
10
- Object.defineProperty(exports, "key", { enumerable: true, get: function () { return key_1.default; } });
14
+ Object.defineProperty(exports, "key", { enumerable: true, get: function () { return __importDefault(key_1).default; } });
11
15
  var label_1 = require("./label");
12
- Object.defineProperty(exports, "label", { enumerable: true, get: function () { return label_1.default; } });
16
+ Object.defineProperty(exports, "label", { enumerable: true, get: function () { return __importDefault(label_1).default; } });
13
17
  var link_1 = require("./link");
14
- Object.defineProperty(exports, "link", { enumerable: true, get: function () { return link_1.default; } });
18
+ Object.defineProperty(exports, "link", { enumerable: true, get: function () { return __importDefault(link_1).default; } });
15
19
  var page_decorator_1 = require("./page-decorator");
16
- Object.defineProperty(exports, "pageDecorator", { enumerable: true, get: function () { return page_decorator_1.default; } });
20
+ Object.defineProperty(exports, "pageDecorator", { enumerable: true, get: function () { return __importDefault(page_decorator_1).default; } });
17
21
  var page_title_1 = require("./page-title");
18
- Object.defineProperty(exports, "pageTitle", { enumerable: true, get: function () { return page_title_1.default; } });
22
+ Object.defineProperty(exports, "pageTitle", { enumerable: true, get: function () { return __importDefault(page_title_1).default; } });
19
23
  var page_url_1 = require("./page-url");
20
- Object.defineProperty(exports, "pageUrl", { enumerable: true, get: function () { return page_url_1.default; } });
24
+ Object.defineProperty(exports, "pageUrl", { enumerable: true, get: function () { return __importDefault(page_url_1).default; } });
21
25
  var weight_1 = require("./weight");
22
- Object.defineProperty(exports, "weight", { enumerable: true, get: function () { return weight_1.default; } });
26
+ Object.defineProperty(exports, "weight", { enumerable: true, get: function () { return __importDefault(weight_1).default; } });
23
27
  //# sourceMappingURL=parsers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../lib/annotations/parsers.ts"],"names":[],"mappings":";;AAAA,yCAAmD;AAA1C,sGAAA,OAAO,OAAa;AAC7B,2DAAmE;AAA1D,sHAAA,OAAO,OAAoB;AACpC,qDAA8D;AAArD,iHAAA,OAAO,OAAkB;AAClC,6BAAuC;AAA9B,0FAAA,OAAO,OAAO;AACvB,iCAA2C;AAAlC,8FAAA,OAAO,OAAS;AACzB,+BAAyC;AAAhC,4FAAA,OAAO,OAAQ;AACxB,mDAA4D;AAAnD,+GAAA,OAAO,OAAiB;AACjC,2CAAoD;AAA3C,uGAAA,OAAO,OAAa;AAC7B,uCAAgD;AAAvC,mGAAA,OAAO,OAAW;AAC3B,mCAA6C;AAApC,gGAAA,OAAO,OAAU"}
1
+ {"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../lib/annotations/parsers.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmD;AAA1C,uHAAA,OAAO,OAAa;AAC7B,2DAAmE;AAA1D,uIAAA,OAAO,OAAoB;AACpC,qDAA8D;AAArD,kIAAA,OAAO,OAAkB;AAClC,6BAAuC;AAA9B,2GAAA,OAAO,OAAO;AACvB,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,mDAA4D;AAAnD,gIAAA,OAAO,OAAiB;AACjC,2CAAoD;AAA3C,wHAAA,OAAO,OAAa;AAC7B,uCAAgD;AAAvC,oHAAA,OAAO,OAAW;AAC3B,mCAA6C;AAApC,iHAAA,OAAO,OAAU","sourcesContent":["export { default as condition } from './condition';\nexport { default as pageDataProvider } from './page-data-provider';\nexport { default as extensionPoint } from './extension-point';\nexport { default as key } from './key';\nexport { default as label } from './label';\nexport { default as link } from './link';\nexport { default as pageDecorator } from './page-decorator';\nexport { default as pageTitle } from './page-title';\nexport { default as pageUrl } from './page-url';\nexport { default as weight } from './weight';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/annotations/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/annotations/types.ts"],"names":[],"mappings":"","sourcesContent":["export type ConditionMap = { [key: string]: string };\n\nexport interface RawAnnotations {\n extensionPoint: string;\n key?: string;\n condition?: string[];\n label?: string;\n link?: string;\n pageDataProvider?: string;\n pageDecorator?: string;\n pageTitle?: string;\n pageUrl?: string;\n weight?: string;\n}\n\nexport type AnnotationKey = keyof RawAnnotations;\n\nexport type MultiValueAnnotationKey = Extract<AnnotationKey, 'condition'>;\n\nexport type SingleValueAnnotationKey = Exclude<AnnotationKey, MultiValueAnnotationKey>;\n\nexport interface AnnotationParserOptions {\n filePath: string;\n cwd: string;\n}\n\nexport type AnnotationParserFunction<T = string | string[]> = (\n rawValue: T | undefined,\n rawAnnotations: RawAnnotations,\n options: AnnotationParserOptions,\n) => Partial<Annotations> | null;\n\nexport type AnnotationParsers = {\n [key in AnnotationKey]: AnnotationParserFunction;\n};\n\n/** Parsed annotations */\nexport interface Annotations {\n /** Module descriptor key e.g. `module.descriptor.key` */\n key: string;\n extensionPoint: string;\n condition?: ConditionMap;\n label?: string;\n link?: string;\n pageDataProvider?: string;\n pageDecorator?: string;\n pageTitle?: string;\n pageUrl?: string;\n weight?: number;\n}\n"]}
@@ -2,8 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ANNOTATION_KEY = 'weight';
4
4
  const weightParser = (rawValue) => {
5
+ if (!rawValue) {
6
+ return null;
7
+ }
5
8
  const parsedWeight = parseInt(rawValue, 10);
6
- if (rawValue && !Number.isNaN(parsedWeight)) {
9
+ if (!Number.isNaN(parsedWeight)) {
7
10
  return {
8
11
  [ANNOTATION_KEY]: parsedWeight,
9
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"weight.js","sourceRoot":"","sources":["../../../lib/annotations/weight.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAkB,QAAQ,CAAC;AAE/C,MAAM,YAAY,GAA6B,CAAC,QAAgB,EAAE,EAAE;IAChE,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAE5C,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QACzC,OAAO;YACH,CAAC,cAAc,CAAC,EAAE,YAAY;SACjC,CAAC;KACL;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"weight.js","sourceRoot":"","sources":["../../../lib/annotations/weight.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAkB,QAAQ,CAAC;AAE/C,MAAM,YAAY,GAAqC,CAAC,QAAQ,EAAE,EAAE;IAChE,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAE5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC7B,OAAO;YACH,CAAC,cAAc,CAAC,EAAE,YAAY;SACjC,CAAC;KACL;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["import type { AnnotationKey, AnnotationParserFunction } from './types';\n\nconst ANNOTATION_KEY: AnnotationKey = 'weight';\n\nconst weightParser: AnnotationParserFunction<string> = (rawValue) => {\n if (!rawValue) {\n return null;\n }\n\n const parsedWeight = parseInt(rawValue, 10);\n\n if (!Number.isNaN(parsedWeight)) {\n return {\n [ANNOTATION_KEY]: parsedWeight,\n };\n }\n\n return null;\n};\n\nexport default weightParser;\n"]}