@atlassian/clientside-extensions-webpack-plugin 5.0.0 → 5.1.0-9864e593-me132vr9

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 (50) hide show
  1. package/dist/cjs/ClientsideExtensionsWebpackPlugin.js +10 -10
  2. package/dist/cjs/ClientsideExtensionsWebpackPlugin.js.map +1 -1
  3. package/dist/cjs/annotations/condition.js.map +1 -1
  4. package/dist/cjs/annotations/default-parser.js.map +1 -1
  5. package/dist/cjs/annotations/extension-point.js.map +1 -1
  6. package/dist/cjs/annotations/index.js +2 -2
  7. package/dist/cjs/annotations/index.js.map +1 -1
  8. package/dist/cjs/annotations/key.js +1 -1
  9. package/dist/cjs/annotations/key.js.map +1 -1
  10. package/dist/cjs/annotations/label.js +1 -1
  11. package/dist/cjs/annotations/label.js.map +1 -1
  12. package/dist/cjs/annotations/link.js +1 -1
  13. package/dist/cjs/annotations/link.js.map +1 -1
  14. package/dist/cjs/annotations/page-data-provider.js.map +1 -1
  15. package/dist/cjs/annotations/page-decorator.js.map +1 -1
  16. package/dist/cjs/annotations/page-title.js.map +1 -1
  17. package/dist/cjs/annotations/page-url.js.map +1 -1
  18. package/dist/cjs/annotations/parsers.js +11 -13
  19. package/dist/cjs/annotations/parsers.js.map +1 -1
  20. package/dist/cjs/annotations/weight.js.map +1 -1
  21. package/dist/cjs/generator/conditions.js +2 -2
  22. package/dist/cjs/generator/conditions.js.map +1 -1
  23. package/dist/cjs/generator/entrypoint.js +4 -4
  24. package/dist/cjs/generator/entrypoint.js.map +1 -1
  25. package/dist/cjs/generator/webfragmentDescriptor.js +2 -2
  26. package/dist/cjs/generator/webfragmentDescriptor.js.map +1 -1
  27. package/dist/cjs/generator/webpageDescriptor.js.map +1 -1
  28. package/dist/cjs/generator/xml.js.map +1 -1
  29. package/dist/cjs/tests/test-helper.js.map +1 -1
  30. package/dist/cjs/transform-comment.js +1 -1
  31. package/dist/cjs/transform-comment.js.map +1 -1
  32. package/dist/cjs/utils.js +4 -4
  33. package/dist/cjs/utils.js.map +1 -1
  34. package/dist/types/annotations/default-parser.d.ts.map +1 -1
  35. package/dist/types/annotations/index.d.ts.map +1 -1
  36. package/dist/types/annotations/types.d.ts +6 -6
  37. package/dist/types/annotations/types.d.ts.map +1 -1
  38. package/dist/types/generator/xml.d.ts +5 -5
  39. package/dist/types/generator/xml.d.ts.map +1 -1
  40. package/dist/types/types.d.ts +1 -1
  41. package/dist/types/types.d.ts.map +1 -1
  42. package/dist/types/utils.d.ts.map +1 -1
  43. package/jest.config.js +0 -9
  44. package/lib/ClientsideExtensionsWebpackPlugin.basic.test.ts +4 -6
  45. package/lib/ClientsideExtensionsWebpackPlugin.conditions.test.ts +7 -9
  46. package/lib/ClientsideExtensionsWebpackPlugin.metadata.test.ts +5 -7
  47. package/lib/ClientsideExtensionsWebpackPlugin.ts +1 -1
  48. package/lib/ClientsideExtensionsWebpackPlugin.webpages.test.ts +7 -9
  49. package/lib/atlassian-webresource-webpack-plugin.d.ts +1 -1
  50. package/package.json +11 -12
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  const tslib_1 = require("tslib");
3
- const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
4
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
3
+ const fs_1 = tslib_1.__importDefault(require("fs"));
4
+ const path_1 = tslib_1.__importDefault(require("path"));
5
5
  const glob_1 = require("glob");
6
- const kebabCase_1 = (0, tslib_1.__importDefault)(require("lodash/kebabCase"));
6
+ const kebabCase_1 = tslib_1.__importDefault(require("lodash/kebabCase"));
7
7
  const pretty_data_1 = require("pretty-data");
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"));
8
+ const webpack_virtual_modules_1 = tslib_1.__importDefault(require("webpack-virtual-modules"));
9
+ const transform_comment_1 = tslib_1.__importDefault(require("./transform-comment"));
10
+ const annotations_1 = tslib_1.__importDefault(require("./annotations"));
11
+ const webfragmentDescriptor_1 = tslib_1.__importDefault(require("./generator/webfragmentDescriptor"));
12
+ const webpageDescriptor_1 = tslib_1.__importStar(require("./generator/webpageDescriptor"));
13
13
  const entrypoint_1 = require("./generator/entrypoint");
14
14
  const utils_1 = require("./utils");
15
- const conditions_1 = (0, tslib_1.__importDefault)(require("./generator/conditions"));
15
+ const conditions_1 = tslib_1.__importDefault(require("./generator/conditions"));
16
16
  class ClientsideExtensionsWebpackPlugin {
17
17
  constructor(options = {}) {
18
18
  if (!options.pattern) {
@@ -149,7 +149,7 @@ class ClientsideExtensionsWebpackPlugin {
149
149
  }
150
150
  const wrmPlugin = plugins.find((p) => p.constructor.name === 'WrmPlugin');
151
151
  if (!wrmPlugin) {
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`);
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`);
153
153
  }
154
154
  return wrmPlugin.options;
155
155
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClientsideExtensionsWebpackPlugin.js","sourceRoot":"","sources":["../../lib/ClientsideExtensionsWebpackPlugin.ts"],"names":[],"mappings":";;AAAA,yDAAoB;AACpB,6DAAwB;AAExB,+BAA4B;AAC5B,8EAAyC;AACzC,6CAA+C;AAC/C,mGAA0D;AAC1D,yFAAmD;AAEnD,6EAA+C;AAE/C,2GAA8E;AAC9E,gGAAuG;AACvG,uDAAiF;AAGjF,mCAA2D;AAE3D,qFAA4E;AAY5E,MAAM,iCAAiC;IASnC,YAAY,UAA8C,EAAE;QACxD,IAAI,CAAC,OAAO,CAAC,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G,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"]}
1
+ {"version":3,"file":"ClientsideExtensionsWebpackPlugin.js","sourceRoot":"","sources":["../../lib/ClientsideExtensionsWebpackPlugin.ts"],"names":[],"mappings":";;AAAA,oDAAoB;AACpB,wDAAwB;AAExB,+BAA4B;AAC5B,yEAAyC;AACzC,6CAA+C;AAC/C,8FAA0D;AAC1D,oFAAmD;AAEnD,wEAA+C;AAE/C,sGAA8E;AAC9E,2FAAuG;AACvG,uDAAiF;AAGjF,mCAA2D;AAE3D,gFAA4E;AAY5E,MAAM,iCAAiC;IASnC,YAAY,UAA8C,EAAE;QACxD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC/E,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAA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E,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"]}
@@ -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,CACX,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,CACX,+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,GAAuC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC9F,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;IAED,MAAM,EAAE,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
+ {"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,CAAC;QACpB,MAAM,IAAI,KAAK,CACX,6DAA6D,QAAQ,qEAAqE,cAAc,aAAa,CACxK,CAAC;IACN,CAAC;IAED,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEvD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACX,+DAA+D,QAAQ,wBAAwB,cAAc,aAAa,CAC7H,CAAC;IACN,CAAC;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,GAAuC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC9F,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,MAAM,YAAY,GAAG,EAAkB,CAAC;IAExC,KAAK,MAAM,gBAAgB,IAAI,QAAQ,EAAE,CAAC;QACtC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAE1E,YAAY,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC/B,CAAC;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 +1 @@
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
+ {"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,CAAC;YACZ,OAAO,IAAI,CAAC;QAChB,CAAC;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,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
+ {"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,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,+BAA+B,cAAc,aAAa,QAAQ,+BAA+B,CAAC,CAAC;IACvH,CAAC;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 = (0, tslib_1.__importStar)(require("./parsers"));
5
- (0, tslib_1.__exportStar)(require("./types"), exports);
4
+ const parsers = tslib_1.__importStar(require("./parsers"));
5
+ 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,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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/annotations/index.ts"],"names":[],"mappings":";;;AAAA,2DAAqC;AAGrC,kDAAwB;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 = (0, tslib_1.__importDefault)(require("path"));
4
+ const path_1 = 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,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"]}
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,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IACtF,IAAI,GAAW,CAAC;IAEhB,IAAI,QAAQ,EAAE,CAAC;QACX,GAAG,GAAG,QAAQ,CAAC;IACnB,CAAC;SAAM,CAAC;QACJ,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAClC,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;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 = (0, tslib_1.__importDefault)(require("./default-parser"));
5
+ const default_parser_1 = tslib_1.__importDefault(require("./default-parser"));
6
6
  exports.ANNOTATION_KEY = 'label';
7
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,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"]}
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../lib/annotations/label.ts"],"names":[],"mappings":";;;;AAAA,8EAAgD;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 = (0, tslib_1.__importDefault)(require("./default-parser"));
5
+ const default_parser_1 = tslib_1.__importDefault(require("./default-parser"));
6
6
  exports.ANNOTATION_KEY = 'link';
7
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,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"]}
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../lib/annotations/link.ts"],"names":[],"mappings":";;;;AAAA,8EAAgD;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"]}
@@ -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,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"]}
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,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACX,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;IACN,CAAC;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"]}
@@ -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+F,CAAC;AAEtI,MAAM,mBAAmB,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAChG,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,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"]}
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+F,CAAC;AAEtI,MAAM,mBAAmB,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAChG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACX,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;IACN,CAAC;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC;IAE/B,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,aAAuB,CAAC,EAAE,CAAC;QAC5D,OAAO,CAAC,IAAI,CACR,yCAAyC,aAAa,cAAc,QAAQ,iIAAiI,6BAA6B,EAAE,CAC/O,CAAC;IACN,CAAC;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"]}
@@ -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,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"]}
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,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,CAAC,yBAAuB,IAAI,cAAc,CAAC,EAAE,CAAC;QAC/C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7B,MAAM,IAAI,KAAK,CACX,+BAA+B,cAAc,wBAAwB,QAAQ,4BAA4B,yBAAuB,wCAAwC,yBAAuB,gCAAgC,CAClO,CAAC;IACN,CAAC;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"]}
@@ -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,GAAqC,CAAC,QAAQ,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,CACX,+BAA+B,sBAAc,wBAAwB,QAAQ,4BAA4B,sBAAoB,wCAAwC,sBAAoB,gCAAgC,CAC5N,CAAC;KACL;IAED,IAAI,qBAAmB,IAAI,cAAc,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
+ {"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,GAAqC,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE;IAC1F,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;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,CAAC;QAC5C,MAAM,IAAI,KAAK,CACX,+BAA+B,sBAAc,wBAAwB,QAAQ,4BAA4B,sBAAoB,wCAAwC,sBAAoB,gCAAgC,CAC5N,CAAC;IACN,CAAC;IAED,IAAI,qBAAmB,IAAI,cAAc,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CACR,wCAAwC,qBAAmB,wBAAwB,QAAQ,0FAA0F,CACxL,CAAC;QAEF,OAAO,WAAW,CAAC;IACvB,CAAC;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,27 +1,25 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.weight = exports.pageUrl = exports.pageTitle = exports.pageDecorator = exports.link = exports.label = exports.key = exports.extensionPoint = exports.pageDataProvider = exports.condition = void 0;
4
+ const tslib_1 = require("tslib");
7
5
  var condition_1 = require("./condition");
8
- Object.defineProperty(exports, "condition", { enumerable: true, get: function () { return __importDefault(condition_1).default; } });
6
+ Object.defineProperty(exports, "condition", { enumerable: true, get: function () { return tslib_1.__importDefault(condition_1).default; } });
9
7
  var page_data_provider_1 = require("./page-data-provider");
10
- Object.defineProperty(exports, "pageDataProvider", { enumerable: true, get: function () { return __importDefault(page_data_provider_1).default; } });
8
+ Object.defineProperty(exports, "pageDataProvider", { enumerable: true, get: function () { return tslib_1.__importDefault(page_data_provider_1).default; } });
11
9
  var extension_point_1 = require("./extension-point");
12
- Object.defineProperty(exports, "extensionPoint", { enumerable: true, get: function () { return __importDefault(extension_point_1).default; } });
10
+ Object.defineProperty(exports, "extensionPoint", { enumerable: true, get: function () { return tslib_1.__importDefault(extension_point_1).default; } });
13
11
  var key_1 = require("./key");
14
- Object.defineProperty(exports, "key", { enumerable: true, get: function () { return __importDefault(key_1).default; } });
12
+ Object.defineProperty(exports, "key", { enumerable: true, get: function () { return tslib_1.__importDefault(key_1).default; } });
15
13
  var label_1 = require("./label");
16
- Object.defineProperty(exports, "label", { enumerable: true, get: function () { return __importDefault(label_1).default; } });
14
+ Object.defineProperty(exports, "label", { enumerable: true, get: function () { return tslib_1.__importDefault(label_1).default; } });
17
15
  var link_1 = require("./link");
18
- Object.defineProperty(exports, "link", { enumerable: true, get: function () { return __importDefault(link_1).default; } });
16
+ Object.defineProperty(exports, "link", { enumerable: true, get: function () { return tslib_1.__importDefault(link_1).default; } });
19
17
  var page_decorator_1 = require("./page-decorator");
20
- Object.defineProperty(exports, "pageDecorator", { enumerable: true, get: function () { return __importDefault(page_decorator_1).default; } });
18
+ Object.defineProperty(exports, "pageDecorator", { enumerable: true, get: function () { return tslib_1.__importDefault(page_decorator_1).default; } });
21
19
  var page_title_1 = require("./page-title");
22
- Object.defineProperty(exports, "pageTitle", { enumerable: true, get: function () { return __importDefault(page_title_1).default; } });
20
+ Object.defineProperty(exports, "pageTitle", { enumerable: true, get: function () { return tslib_1.__importDefault(page_title_1).default; } });
23
21
  var page_url_1 = require("./page-url");
24
- Object.defineProperty(exports, "pageUrl", { enumerable: true, get: function () { return __importDefault(page_url_1).default; } });
22
+ Object.defineProperty(exports, "pageUrl", { enumerable: true, get: function () { return tslib_1.__importDefault(page_url_1).default; } });
25
23
  var weight_1 = require("./weight");
26
- Object.defineProperty(exports, "weight", { enumerable: true, get: function () { return __importDefault(weight_1).default; } });
24
+ Object.defineProperty(exports, "weight", { enumerable: true, get: function () { return tslib_1.__importDefault(weight_1).default; } });
27
25
  //# sourceMappingURL=parsers.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../../lib/annotations/parsers.ts"],"names":[],"mappings":";;;;AAAA,yCAAmD;AAA1C,+HAAA,OAAO,OAAa;AAC7B,2DAAmE;AAA1D,+IAAA,OAAO,OAAoB;AACpC,qDAA8D;AAArD,0IAAA,OAAO,OAAkB;AAClC,6BAAuC;AAA9B,mHAAA,OAAO,OAAO;AACvB,iCAA2C;AAAlC,uHAAA,OAAO,OAAS;AACzB,+BAAyC;AAAhC,qHAAA,OAAO,OAAQ;AACxB,mDAA4D;AAAnD,wIAAA,OAAO,OAAiB;AACjC,2CAAoD;AAA3C,gIAAA,OAAO,OAAa;AAC7B,uCAAgD;AAAvC,4HAAA,OAAO,OAAW;AAC3B,mCAA6C;AAApC,yHAAA,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":"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"]}
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,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAE5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO;YACH,CAAC,cAAc,CAAC,EAAE,YAAY;SACjC,CAAC;IACN,CAAC;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"]}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = transformConditionToConditionMapObject;
3
4
  const tslib_1 = require("tslib");
4
- const set_1 = (0, tslib_1.__importDefault)(require("lodash/set"));
5
+ const set_1 = tslib_1.__importDefault(require("lodash/set"));
5
6
  function transformConditionToConditionMapObject(condition) {
6
7
  const conditionMap = {};
7
8
  try {
@@ -14,5 +15,4 @@ function transformConditionToConditionMapObject(condition) {
14
15
  }
15
16
  return conditionMap;
16
17
  }
17
- exports.default = transformConditionToConditionMapObject;
18
18
  //# sourceMappingURL=conditions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../lib/generator/conditions.ts"],"names":[],"mappings":";;;AAAA,kEAA6B;AAI7B,SAAwB,sCAAsC,CAAC,SAAuB;IAClF,MAAM,YAAY,GAAG,EAAe,CAAC;IAErC,IAAI;QACA,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YACtD,IAAA,aAAG,EAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SACrC;KACJ;IAAC,OAAO,CAAC,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;KAC9F;IAED,OAAO,YAAY,CAAC;AACxB,CAAC;AAZD,yDAYC","sourcesContent":["import set from 'lodash/set';\nimport type { ConditionMap } from '../annotations';\nimport type { Condition } from './xml';\n\nexport default function transformConditionToConditionMapObject(condition: ConditionMap): Condition {\n const conditionMap = {} as Condition;\n\n try {\n for (const [keyPath, value] of Object.entries(condition)) {\n set(conditionMap, keyPath, value);\n }\n } catch (e) {\n throw new Error(`Client-side Extension: The syntax of \"@condition\" annotation is invalid`);\n }\n\n return conditionMap;\n}\n"]}
1
+ {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../lib/generator/conditions.ts"],"names":[],"mappings":";;AAIA,yDAYC;;AAhBD,6DAA6B;AAI7B,SAAwB,sCAAsC,CAAC,SAAuB;IAClF,MAAM,YAAY,GAAG,EAAe,CAAC;IAErC,IAAI,CAAC;QACD,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACvD,IAAA,aAAG,EAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC","sourcesContent":["import set from 'lodash/set';\nimport type { ConditionMap } from '../annotations';\nimport type { Condition } from './xml';\n\nexport default function transformConditionToConditionMapObject(condition: ConditionMap): Condition {\n const conditionMap = {} as Condition;\n\n try {\n for (const [keyPath, value] of Object.entries(condition)) {\n set(conditionMap, keyPath, value);\n }\n } catch (e) {\n throw new Error(`Client-side Extension: The syntax of \"@condition\" annotation is invalid`);\n }\n\n return conditionMap;\n}\n"]}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateEntrypointCode = exports.isPageExtension = void 0;
3
+ exports.isPageExtension = void 0;
4
+ exports.generateEntrypointCode = generateEntrypointCode;
4
5
  const tslib_1 = require("tslib");
5
- const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
6
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
6
+ const fs_1 = tslib_1.__importDefault(require("fs"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
7
8
  const extensionEntrypointTemplate = fs_1.default.readFileSync(path_1.default.join(__dirname, '..', 'runtime', 'extension-entrypoint.js'), 'utf8');
8
9
  const webPageEntrypointTemplate = fs_1.default.readFileSync(path_1.default.join(__dirname, '..', 'runtime', 'web-page-entrypoint.js'), 'utf8');
9
10
  const isPageExtension = (extensionOptions) => {
@@ -37,5 +38,4 @@ function generateEntrypointCode(extensionOption) {
37
38
  url: link,
38
39
  }));
39
40
  }
40
- exports.generateEntrypointCode = generateEntrypointCode;
41
41
  //# sourceMappingURL=entrypoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../lib/generator/entrypoint.ts"],"names":[],"mappings":";;;;AAAA,yDAAoB;AACpB,6DAAwB;AAGxB,MAAM,2BAA2B,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,yBAAyB,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9H,MAAM,yBAAyB,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SA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rypointTemplate = fs.readFileSync(path.join(__dirname, '..', 'runtime', 'extension-entrypoint.js'), 'utf8');\nconst webPageEntrypointTemplate = fs.readFileSync(path.join(__dirname, '..', 'runtime', 'web-page-entrypoint.js'), 'utf8');\n\nexport const isPageExtension = (extensionOptions: ClientsideExtensionsOptions) => {\n return Boolean(extensionOptions.pageUrl);\n};\n\nconst warnOnAnnotationDeprecation = (annotation: string, attribute: string = annotation): void => {\n console.error(`!!!\nThe \"@${annotation}\" annotation is deprecated. Please provide the \"${attribute}\" in your javascript code instead.\n!!!`);\n};\n\nexport function generateEntrypointCode(extensionOption: ClientsideExtensionsOptions) {\n const template = isPageExtension(extensionOption) ? webPageEntrypointTemplate : extensionEntrypointTemplate;\n\n const { weight, extensionPoint, label, link } = extensionOption;\n\n if (label) {\n warnOnAnnotationDeprecation('label');\n }\n if (weight) {\n warnOnAnnotationDeprecation('weight');\n }\n if (link) {\n warnOnAnnotationDeprecation('link', 'url');\n }\n\n return template\n .replace(/REPLACE_WITH_PATHNAME/g, extensionOption.filePath)\n .replace(/REPLACE_WITH_PLUGIN_ID/g, extensionOption.fullyQualifiedNamespace)\n .replace(\n /REPLACE_WITH_EXTENSION_OPTIONS/g,\n JSON.stringify({\n location: extensionPoint,\n label,\n weight,\n url: link,\n }),\n );\n}\n"]}
1
+ {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../lib/generator/entrypoint.ts"],"names":[],"mappings":";;;AAiBA,wDA2BC;;AA5CD,oDAAoB;AACpB,wDAAwB;AAGxB,MAAM,2BAA2B,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,yBAAyB,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9H,MAAM,yBAAyB,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,wBAAwB,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpH,MAAM,eAAe,GAAG,CAAC,gBAA6C,EAAE,EAAE;IAC7E,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEF,MAAM,2BAA2B,GAAG,CAAC,UAAkB,EAAE,YAAoB,UAAU,EAAQ,EAAE;IAC7F,OAAO,CAAC,KAAK,CAAC;QACV,UAAU,mDAAmD,SAAS;IAC1E,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,SAAgB,sBAAsB,CAAC,eAA4C;IAC/E,MAAM,QAAQ,GAAG,IAAA,uBAAe,EAAC,eAAe,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,CAAC;IAE5G,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;IAEhE,IAAI,KAAK,EAAE,CAAC;QACR,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACT,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACP,2BAA2B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,QAAQ;SACV,OAAO,CAAC,wBAAwB,EAAE,eAAe,CAAC,QAAQ,CAAC;SAC3D,OAAO,CAAC,yBAAyB,EAAE,eAAe,CAAC,uBAAuB,CAAC;SAC3E,OAAO,CACJ,iCAAiC,EACjC,IAAI,CAAC,SAAS,CAAC;QACX,QAAQ,EAAE,cAAc;QACxB,KAAK;QACL,MAAM;QACN,GAAG,EAAE,IAAI;KACZ,CAAC,CACL,CAAC;AACV,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { ClientsideExtensionsOptions } from '../types';\n\nconst extensionEntrypointTemplate = fs.readFileSync(path.join(__dirname, '..', 'runtime', 'extension-entrypoint.js'), 'utf8');\nconst webPageEntrypointTemplate = fs.readFileSync(path.join(__dirname, '..', 'runtime', 'web-page-entrypoint.js'), 'utf8');\n\nexport const isPageExtension = (extensionOptions: ClientsideExtensionsOptions) => {\n return Boolean(extensionOptions.pageUrl);\n};\n\nconst warnOnAnnotationDeprecation = (annotation: string, attribute: string = annotation): void => {\n console.error(`!!!\nThe \"@${annotation}\" annotation is deprecated. Please provide the \"${attribute}\" in your javascript code instead.\n!!!`);\n};\n\nexport function generateEntrypointCode(extensionOption: ClientsideExtensionsOptions) {\n const template = isPageExtension(extensionOption) ? webPageEntrypointTemplate : extensionEntrypointTemplate;\n\n const { weight, extensionPoint, label, link } = extensionOption;\n\n if (label) {\n warnOnAnnotationDeprecation('label');\n }\n if (weight) {\n warnOnAnnotationDeprecation('weight');\n }\n if (link) {\n warnOnAnnotationDeprecation('link', 'url');\n }\n\n return template\n .replace(/REPLACE_WITH_PATHNAME/g, extensionOption.filePath)\n .replace(/REPLACE_WITH_PLUGIN_ID/g, extensionOption.fullyQualifiedNamespace)\n .replace(\n /REPLACE_WITH_EXTENSION_OPTIONS/g,\n JSON.stringify({\n location: extensionPoint,\n label,\n weight,\n url: link,\n }),\n );\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = generateWebfragmentDescriptor;
3
4
  const tslib_1 = require("tslib");
4
5
  const xml_1 = require("./xml");
5
- const conditions_1 = (0, tslib_1.__importDefault)(require("./conditions"));
6
+ const conditions_1 = tslib_1.__importDefault(require("./conditions"));
6
7
  const utils_1 = require("../utils");
7
8
  /**
8
9
  * This generator ensures that web-fragment tags are generated for the extension. It will generate:
@@ -24,5 +25,4 @@ function generateWebfragmentDescriptor(options) {
24
25
  .map((value) => (0, utils_1.replaceKey)(value, options.fullyQualifiedNamespace));
25
26
  return (0, xml_1.renderElement)('web-item', { key: options.key, section: options.extensionPoint, weight: options.weight }, children);
26
27
  }
27
- exports.default = generateWebfragmentDescriptor;
28
28
  //# sourceMappingURL=webfragmentDescriptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webfragmentDescriptor.js","sourceRoot":"","sources":["../../../lib/generator/webfragmentDescriptor.ts"],"names":[],"mappings":";;;AAAA,+BAAuD;AAEvD,2EAAkE;AAClE,oCAA4D;AAE5D;;;;;;GAMG;AACH,SAAwB,6BAA6B,CAAC,OAAoC;IACtF,MAAM,KAAK,GAAG,IAAA,mBAAa,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,KAAM,EAAE,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,mBAAa,EAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE,IAAI,UAAU,CAAC;IAEf,IAAI,OAAO,CAAC,SAAS,EAAE;QACnB,MAAM,YAAY,GAAG,IAAA,oBAAsC,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE/E,UAAU,GAAG,IAAA,qBAAe,EAAC,YAAY,CAAC,CAAC;KAC9C;IAED,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC;SACrC,MAAM,CAAC,4BAAoB,CAAC;SAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAExE,OAAO,IAAA,mBAAa,EAAC,UAAU,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,MAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC/H,CAAC;AAjBD,gDAiBC","sourcesContent":["import { renderElement, renderCondition } from './xml';\nimport type { ClientsideExtensionsOptions } from '../types';\nimport transformConditionToConditionMapObject from './conditions';\nimport { isNotNullOrUndefined, replaceKey } from '../utils';\n\n/**\n * This generator ensures that web-fragment tags are generated for the extension. It will generate:\n * - a <web-item> tag required for the PageExtension\n * - a legacy <web-item> descriptor required by the extensions in CSE version 1.x\n * The generation of the legacy <web-item> could be removed once all the products migrate to use only CSE 2+\n * in a major version of all product. Currently, both CSE 1.x and 2.x are used by Bitbucket Server 7.x.\n */\nexport default function generateWebfragmentDescriptor(options: ClientsideExtensionsOptions): string | null {\n const label = renderElement('label', { key: options.label! });\n const link = options.link && renderElement('link', {}, options.link);\n\n let conditions;\n\n if (options.condition) {\n const conditionMap = transformConditionToConditionMapObject(options.condition);\n\n conditions = renderCondition(conditionMap);\n }\n\n const children = [label, link, conditions]\n .filter(isNotNullOrUndefined)\n .map((value) => replaceKey(value, options.fullyQualifiedNamespace));\n\n return renderElement('web-item', { key: options.key, section: options.extensionPoint, weight: options.weight! }, children);\n}\n"]}
1
+ {"version":3,"file":"webfragmentDescriptor.js","sourceRoot":"","sources":["../../../lib/generator/webfragmentDescriptor.ts"],"names":[],"mappings":";;AAYA,gDAiBC;;AA7BD,+BAAuD;AAEvD,sEAAkE;AAClE,oCAA4D;AAE5D;;;;;;GAMG;AACH,SAAwB,6BAA6B,CAAC,OAAoC;IACtF,MAAM,KAAK,GAAG,IAAA,mBAAa,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,KAAM,EAAE,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,mBAAa,EAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE,IAAI,UAAU,CAAC;IAEf,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,YAAY,GAAG,IAAA,oBAAsC,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE/E,UAAU,GAAG,IAAA,qBAAe,EAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC;SACrC,MAAM,CAAC,4BAAoB,CAAC;SAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAExE,OAAO,IAAA,mBAAa,EAAC,UAAU,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,MAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC/H,CAAC","sourcesContent":["import { renderElement, renderCondition } from './xml';\nimport type { ClientsideExtensionsOptions } from '../types';\nimport transformConditionToConditionMapObject from './conditions';\nimport { isNotNullOrUndefined, replaceKey } from '../utils';\n\n/**\n * This generator ensures that web-fragment tags are generated for the extension. It will generate:\n * - a <web-item> tag required for the PageExtension\n * - a legacy <web-item> descriptor required by the extensions in CSE version 1.x\n * The generation of the legacy <web-item> could be removed once all the products migrate to use only CSE 2+\n * in a major version of all product. Currently, both CSE 1.x and 2.x are used by Bitbucket Server 7.x.\n */\nexport default function generateWebfragmentDescriptor(options: ClientsideExtensionsOptions): string | null {\n const label = renderElement('label', { key: options.label! });\n const link = options.link && renderElement('link', {}, options.link);\n\n let conditions;\n\n if (options.condition) {\n const conditionMap = transformConditionToConditionMapObject(options.condition);\n\n conditions = renderCondition(conditionMap);\n }\n\n const children = [label, link, conditions]\n .filter(isNotNullOrUndefined)\n .map((value) => replaceKey(value, options.fullyQualifiedNamespace));\n\n return renderElement('web-item', { key: options.key, section: options.extensionPoint, weight: options.weight! }, children);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"webpageDescriptor.js","sourceRoot":"","sources":["../../../lib/generator/webpageDescriptor.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AAEtC,oCAA6E;AAEhE,QAAA,2BAA2B,GAAG,eAAe,CAAC;AAE3D,MAAM,yBAAy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AAc,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,cAAc,CAAC;SAC3D,MAAM,CAAC,4BAAoB,CAAC;SAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAExE,OAAO,IAAA,mBAAa,EAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,kBAAe,yBAAyB,CAAC","sourcesContent":["import { renderElement } from './xml';\nimport type { ClientsideExtensionsOptions } from '../types';\nimport { isNotNullOrUndefined, isPageExtension, replaceKey } from '../utils';\n\nexport const PAGE_DATA_PROVIDER_DATA_KEY = 'data-provider';\n\nconst generateWebpageDescriptor = (options: ClientsideExtensionsOptions): string | null => {\n if (!isPageExtension(options)) {\n return null;\n }\n\n // Complete data provider key e.g. [groupId].[artifactId]:[webResourceKey].[dataKey]\n let pageDataProviderKey;\n\n if (options.pageDataProvider) {\n pageDataProviderKey = `${options.pluginKey}:${options.entryPoint}.${PAGE_DATA_PROVIDER_DATA_KEY}`;\n }\n\n // Ensure the module descriptor key is unique\n const moduleKey = `webpage-${options.key}`;\n\n // Get a full web-resource key for the extension entrypoint web-resource\n const webResourceKey = `${options.pluginKey}:${options.entryPoint}`;\n\n const webpageAttributes = [\n ['key', moduleKey],\n ['extension-point', options.extensionPoint],\n ['extension-key', options.fullyQualifiedNamespace],\n ['page-data-provider-key', pageDataProviderKey],\n ['page-decorator', options.pageDecorator],\n ];\n\n const attributes = Object.fromEntries(webpageAttributes.filter(([, value]) => value));\n\n const urlPatternNode = renderElement('url-pattern', null, options.pageUrl);\n\n let pageTitleNode;\n if (options.pageTitle) {\n pageTitleNode = renderElement('page-title', { key: options.pageTitle });\n }\n\n const dependencyNode = renderElement('dependency', null, webResourceKey);\n\n const children = [urlPatternNode, pageTitleNode, dependencyNode]\n .filter(isNotNullOrUndefined)\n .map((value) => replaceKey(value, options.fullyQualifiedNamespace));\n\n return renderElement('web-page', attributes, children);\n};\n\nexport default generateWebpageDescriptor;\n"]}
1
+ {"version":3,"file":"webpageDescriptor.js","sourceRoot":"","sources":["../../../lib/generator/webpageDescriptor.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AAEtC,oCAA6E;AAEhE,QAAA,2BAA2B,GAAG,eAAe,CAAC;AAE3D,MAAM,yBAAyB,GAAG,CAAC,OAAoC,EAAiB,EAAE;IACtF,IAAI,CAAC,IAAA,uBAAe,EAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,oFAAoF;IACpF,IAAI,mBAAmB,CAAC;IAExB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC3B,mBAAmB,GAAG,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,UAAU,IAAI,mCAA2B,EAAE,CAAC;IACtG,CAAC;IAED,6CAA6C;IAC7C,MAAM,SAAS,GAAG,WAAW,OAAO,CAAC,GAAG,EAAE,CAAC;IAE3C,wEAAwE;IACxE,MAAM,cAAc,GAAG,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAEpE,MAAM,iBAAiB,GAAG;QACtB,CAAC,KAAK,EAAE,SAAS,CAAC;QAClB,CAAC,iBAAiB,EAAE,OAAO,CAAC,cAAc,CAAC;QAC3C,CAAC,eAAe,EAAE,OAAO,CAAC,uBAAuB,CAAC;QAClD,CAAC,wBAAwB,EAAE,mBAAmB,CAAC;QAC/C,CAAC,gBAAgB,EAAE,OAAO,CAAC,aAAa,CAAC;KAC5C,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,IAAA,mBAAa,EAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3E,IAAI,aAAa,CAAC;IAClB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACpB,aAAa,GAAG,IAAA,mBAAa,EAAC,YAAY,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,mBAAa,EAAC,YAAY,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,cAAc,CAAC;SAC3D,MAAM,CAAC,4BAAoB,CAAC;SAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAExE,OAAO,IAAA,mBAAa,EAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,kBAAe,yBAAyB,CAAC","sourcesContent":["import { renderElement } from './xml';\nimport type { ClientsideExtensionsOptions } from '../types';\nimport { isNotNullOrUndefined, isPageExtension, replaceKey } from '../utils';\n\nexport const PAGE_DATA_PROVIDER_DATA_KEY = 'data-provider';\n\nconst generateWebpageDescriptor = (options: ClientsideExtensionsOptions): string | null => {\n if (!isPageExtension(options)) {\n return null;\n }\n\n // Complete data provider key e.g. [groupId].[artifactId]:[webResourceKey].[dataKey]\n let pageDataProviderKey;\n\n if (options.pageDataProvider) {\n pageDataProviderKey = `${options.pluginKey}:${options.entryPoint}.${PAGE_DATA_PROVIDER_DATA_KEY}`;\n }\n\n // Ensure the module descriptor key is unique\n const moduleKey = `webpage-${options.key}`;\n\n // Get a full web-resource key for the extension entrypoint web-resource\n const webResourceKey = `${options.pluginKey}:${options.entryPoint}`;\n\n const webpageAttributes = [\n ['key', moduleKey],\n ['extension-point', options.extensionPoint],\n ['extension-key', options.fullyQualifiedNamespace],\n ['page-data-provider-key', pageDataProviderKey],\n ['page-decorator', options.pageDecorator],\n ];\n\n const attributes = Object.fromEntries(webpageAttributes.filter(([, value]) => value));\n\n const urlPatternNode = renderElement('url-pattern', null, options.pageUrl);\n\n let pageTitleNode;\n if (options.pageTitle) {\n pageTitleNode = renderElement('page-title', { key: options.pageTitle });\n }\n\n const dependencyNode = renderElement('dependency', null, webResourceKey);\n\n const children = [urlPatternNode, pageTitleNode, dependencyNode]\n .filter(isNotNullOrUndefined)\n .map((value) => replaceKey(value, options.fullyQualifiedNamespace));\n\n return renderElement('web-page', attributes, children);\n};\n\nexport default generateWebpageDescriptor;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../lib/generator/xml.ts"],"names":[],"mappings":";;;AAGA,MAAM,mBAAmB,GAAG,CAAC,UAAsC,EAAE,EAAE;IACnE,IAAI,CAAC,UAAU,EAAE;QACb,OAAO,EAAE,CAAC;KACb;IAED,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAChC,OAAO,UAAU,CAAC;KACrB;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SACzB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACT,MAAM,GAAG,GAAG,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QAClF,OAAO,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;IAC7B,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,UAAsC,EAAE,QAA4B,EAAE,EAAE;IAChH,qEAAqE;IACrE,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,IAAI,IAAI,mBAAmB,C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AAE,EACvE,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CACjC,CAAC;AACN,CAAC,CAAC;AAnBW,QAAA,eAAe,mBAmB1B","sourcesContent":["type Attributes = {\n [key: string]: string | number;\n};\nconst serializeAttributes = (attributes: Attributes | string | null) => {\n if (!attributes) {\n return '';\n }\n\n if (typeof attributes === 'string') {\n return attributes;\n }\n\n return Object.keys(attributes)\n .map((key) => {\n const val = typeof attributes[key] === 'undefined' ? '' : String(attributes[key]);\n return `${key}=\"${val}\"`;\n })\n .join(' ');\n};\n\nexport const renderElement = (name: string, attributes: Attributes | string | null, children?: string | string[]) => {\n // render self-closing tags based on whether there is no child input.\n if (!children) {\n return `<${name} ${serializeAttributes(attributes)}/>`;\n }\n\n // convert children array in to a string.\n if (Array.isArray(children)) {\n children = children.join('\\n');\n }\n\n return `<${name} ${serializeAttributes(attributes)}>${children}</${name}>`;\n};\n\ntype Param = {\n attributes: Attributes;\n value: string | string[];\n};\nconst renderParams = (params: Param[]) => {\n if (!params) {\n return '';\n }\n return params.map((param) => renderElement('param', param.attributes, param.value)).join('');\n};\n\nexport type Condition = {\n conditions?: Condition[];\n type: string;\n invert: boolean;\n class: string;\n params: Param[];\n};\nexport const renderCondition = (condition?: null | Condition | Condition[]): string => {\n if (!condition) {\n return '';\n }\n\n // we have actual conditions\n if (Array.isArray(condition)) {\n return condition.map(renderCondition).join('');\n }\n // we have a \"conditions\"-joiner for multiple sub conditions\n if (condition.type) {\n return renderElement('conditions', { type: condition.type }, renderCondition(condition.conditions));\n }\n\n return renderElement(\n 'condition',\n `class=\"${condition.class}\" ${condition.invert ? 'invert=\"true\"' : ''}`,\n renderParams(condition.params),\n );\n};\n"]}
1
+ {"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../lib/generator/xml.ts"],"names":[],"mappings":";;;AAGA,MAAM,mBAAmB,GAAG,CAAC,UAAsC,EAAE,EAAE;IACnE,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,EAAE,CAAC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IAAI,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC,CAAC;AASK,MAAM,eAAe,GAAG,CAAC,SAA0C,EAAU,EAAE;IAClF,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACd,CAAC;IAED,4BAA4B;IAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC,GAAG,CAAC,uBAAe,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,4DAA4D;IAC5D,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,IAAA,qBAAa,EAAC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,IAAA,uBAAe,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACxG,CAAC;IAED,OAAO,IAAA,qBAAa,EAChB,WAAW,EACX,UAAU,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,EACvE,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CACjC,CAAC;AACN,CAAC,CAAC;AAnBW,QAAA,eAAe,mBAmB1B","sourcesContent":["type Attributes = {\n [key: string]: string | number;\n};\nconst serializeAttributes = (attributes: Attributes | string | null) => {\n if (!attributes) {\n return '';\n }\n\n if (typeof attributes === 'string') {\n return attributes;\n }\n\n return Object.keys(attributes)\n .map((key) => {\n const val = typeof attributes[key] === 'undefined' ? '' : String(attributes[key]);\n return `${key}=\"${val}\"`;\n })\n .join(' ');\n};\n\nexport const renderElement = (name: string, attributes: Attributes | string | null, children?: string | string[]) => {\n // render self-closing tags based on whether there is no child input.\n if (!children) {\n return `<${name} ${serializeAttributes(attributes)}/>`;\n }\n\n // convert children array in to a string.\n if (Array.isArray(children)) {\n children = children.join('\\n');\n }\n\n return `<${name} ${serializeAttributes(attributes)}>${children}</${name}>`;\n};\n\ntype Param = {\n attributes: Attributes;\n value: string | string[];\n};\nconst renderParams = (params: Param[]) => {\n if (!params) {\n return '';\n }\n return params.map((param) => renderElement('param', param.attributes, param.value)).join('');\n};\n\nexport type Condition = {\n conditions?: Condition[];\n type: string;\n invert: boolean;\n class: string;\n params: Param[];\n};\nexport const renderCondition = (condition?: null | Condition | Condition[]): string => {\n if (!condition) {\n return '';\n }\n\n // we have actual conditions\n if (Array.isArray(condition)) {\n return condition.map(renderCondition).join('');\n }\n // we have a \"conditions\"-joiner for multiple sub conditions\n if (condition.type) {\n return renderElement('conditions', { type: condition.type }, renderCondition(condition.conditions));\n }\n\n return renderElement(\n 'condition',\n `class=\"${condition.class}\" ${condition.invert ? 'invert=\"true\"' : ''}`,\n renderParams(condition.params),\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../lib/tests/test-helper.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,wFAAwF;AACxF,qDAAoD;AAE7C,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC5C,IAAI,CAAC,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,kBAAkB,CAAC,CAAC;KAC7E;IAED,OAAO,MAAM,CAAC,IAAA,iBAAY,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB;AAEK,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAE,EAAE;IACtD,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACvB,OAAO,EAAE,CAAC;KACb;IAED,MAAM,eAAe,GAAG;QACpB,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,OAAO;QACrB,mBAAmB,EAAE,EAAE;KAC1B,CAAC;IAEF,MAAM,IAAI,GAAG,IAAA,uBAAQ,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAErC,OAAO,IAAI,CAAC,OAAO,CAAc,CAAC;AACtC,CAAC,CAAC;AAhBW,QAAA,sBAAsB,0BAgBjC","sourcesContent":["import { readFileSync, existsSync } from 'fs';\n// eslint-disable-next-line import/no-extraneous-dependencies,node/no-unpublished-import\nimport { parse as parseXml } from 'fast-xml-parser';\n\nexport const fileContent = (filePath: string) => {\n if (!existsSync(filePath)) {\n throw new Error(`File generated by webpack \"${filePath}\" does not exist`);\n }\n\n return String(readFileSync(filePath, { encoding: 'utf8' }));\n};\n\nexport const getOutputContentAsJson = (content: string) => {\n if (content.trim() === '') {\n return '';\n }\n\n const xmlParseOptions = {\n arrayMode: true,\n ignoreAttributes: false,\n attrNodeName: 'attrs',\n attributeNamePrefix: '',\n };\n\n const root = parseXml(content, xmlParseOptions);\n const rootKey = Object.keys(root)[0];\n\n return root[rootKey] as [unknown];\n};\n"]}
1
+ {"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../lib/tests/test-helper.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,wFAAwF;AACxF,qDAAoD;AAE7C,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC5C,IAAI,CAAC,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,kBAAkB,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC,IAAA,iBAAY,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB;AAEK,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAE,EAAE;IACtD,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,eAAe,GAAG;QACpB,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,OAAO;QACrB,mBAAmB,EAAE,EAAE;KAC1B,CAAC;IAEF,MAAM,IAAI,GAAG,IAAA,uBAAQ,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAErC,OAAO,IAAI,CAAC,OAAO,CAAc,CAAC;AACtC,CAAC,CAAC;AAhBW,QAAA,sBAAsB,0BAgBjC","sourcesContent":["import { readFileSync, existsSync } from 'fs';\n// eslint-disable-next-line import/no-extraneous-dependencies,node/no-unpublished-import\nimport { parse as parseXml } from 'fast-xml-parser';\n\nexport const fileContent = (filePath: string) => {\n if (!existsSync(filePath)) {\n throw new Error(`File generated by webpack \"${filePath}\" does not exist`);\n }\n\n return String(readFileSync(filePath, { encoding: 'utf8' }));\n};\n\nexport const getOutputContentAsJson = (content: string) => {\n if (content.trim() === '') {\n return '';\n }\n\n const xmlParseOptions = {\n arrayMode: true,\n ignoreAttributes: false,\n attrNodeName: 'attrs',\n attributeNamePrefix: '',\n };\n\n const root = parseXml(content, xmlParseOptions);\n const rootKey = Object.keys(root)[0];\n\n return root[rootKey] as [unknown];\n};\n"]}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const comment_parser_1 = require("comment-parser");
5
- const camelCase_1 = (0, tslib_1.__importDefault)(require("lodash/camelCase"));
5
+ const camelCase_1 = tslib_1.__importDefault(require("lodash/camelCase"));
6
6
  const utils_1 = require("./utils");
7
7
  const CLIENTSIDE_EXTENSION_ANNOTATION = 'clientside-extension';
8
8
  const MULTI_VALUE_ANNOT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,CAAC,CAAC;YAC7C,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,SAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;YAEjF,WAAW,CAAC,aAAwC,CAAC,GAAG,CAAC,GAAG,gBAAgB,EAAE,eAAe,CAAC,CAAC;YAE/F,uCAAuC;YACvC,SAAS;SACZ;QAED,WAAW,CAAC,aAAyC,CAAC,GAAG,eAAe,CAAC;KAC5E;IAED,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["import type { Block } from 'comment-parser';\nimport { parse as parseComment } from 'comment-parser';\nimport camelCase from 'lodash/camelCase';\nimport type { AnnotationKey, MultiValueAnnotationKey, RawAnnotations, SingleValueAnnotationKey } from './annotations';\nimport { debugLog } from './utils';\n\nconst CLIENTSIDE_EXTENSION_ANNOTATION = 'clientside-extension';\nconst MULTI_VALUE_ANNOTATIONS = ['condition'];\n\nconst getClientSideExtensionAnnotations = (comments: Block[]) =>\n comments.find((comment) => comment.tags.some(({ tag }) => tag === CLIENTSIDE_EXTENSION_ANNOTATION));\n\n/**\n * Transforms a raw comment with annotations into annotations map\n */\nconst transformComment = (fileContent: string) => {\n const comments = parseComment(fileContent);\n\n debugLog(`Parsing raw comments: ${JSON.stringify(comments)}`);\n\n const extensionAnnotationsComment = getClientSideExtensionAnnotations(comments);\n\n if (!extensionAnnotationsComment) {\n return null;\n }\n\n const annotations = {} as RawAnnotations;\n\n for (const { tag, name, description } of extensionAnnotationsComment.tags) {\n const annotationKey = camelCase(tag) as AnnotationKey;\n const annotationValue = [name, description].join(' ').trim();\n\n // Merge annotations of the same type\n if (MULTI_VALUE_ANNOTATIONS.includes(annotationKey)) {\n const prevValue = annotations[annotationKey];\n const wrappedPrevValue = Array.isArray(prevValue) ? (prevValue as string[]) : [];\n\n annotations[annotationKey as MultiValueAnnotationKey] = [...wrappedPrevValue, annotationValue];\n\n // eslint-disable-next-line no-continue\n continue;\n }\n\n annotations[annotationKey as SingleValueAnnotationKey] = annotationValue;\n }\n\n return annotations;\n};\n\nexport default transformComment;\n"]}
1
+ {"version":3,"file":"transform-comment.js","sourceRoot":"","sources":["../../lib/transform-comment.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AACvD,yEAAyC;AAEzC,mCAAmC;AAEnC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AAC/D,MAAM,uBAAuB,GAAG,CAAC,WAAW,CAAC,CAAC;AAE9C,MAAM,iCAAiC,GAAG,CAAC,QAAiB,EAAE,EAAE,CAC5D,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,+BAA+B,CAAC,CAAC,CAAC;AAExG;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC7C,MAAM,QAAQ,GAAG,IAAA,sBAAY,EAAC,WAAW,CAAC,CAAC;IAE3C,IAAA,gBAAQ,EAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE9D,MAAM,2BAA2B,GAAG,iCAAiC,CAAC,QAAQ,CAAC,CAAC;IAEhF,IAAI,CAAC,2BAA2B,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,WAAW,GAAG,EAAoB,CAAC;IAEzC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,2BAA2B,CAAC,IAAI,EAAE,CAAC;QACxE,MAAM,aAAa,GAAG,IAAA,mBAAS,EAAC,GAAG,CAAkB,CAAC;QACtD,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAE7D,qCAAqC;QACrC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YAClD,MAAM,SAAS,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;YAC7C,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAE,SAAsB,CAAC,CAAC,CAAC,EAAE,CAAC;YAEjF,WAAW,CAAC,aAAwC,CAAC,GAAG,CAAC,GAAG,gBAAgB,EAAE,eAAe,CAAC,CAAC;YAE/F,uCAAuC;YACvC,SAAS;QACb,CAAC;QAED,WAAW,CAAC,aAAyC,CAAC,GAAG,eAAe,CAAC;IAC7E,CAAC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["import type { Block } from 'comment-parser';\nimport { parse as parseComment } from 'comment-parser';\nimport camelCase from 'lodash/camelCase';\nimport type { AnnotationKey, MultiValueAnnotationKey, RawAnnotations, SingleValueAnnotationKey } from './annotations';\nimport { debugLog } from './utils';\n\nconst CLIENTSIDE_EXTENSION_ANNOTATION = 'clientside-extension';\nconst MULTI_VALUE_ANNOTATIONS = ['condition'];\n\nconst getClientSideExtensionAnnotations = (comments: Block[]) =>\n comments.find((comment) => comment.tags.some(({ tag }) => tag === CLIENTSIDE_EXTENSION_ANNOTATION));\n\n/**\n * Transforms a raw comment with annotations into annotations map\n */\nconst transformComment = (fileContent: string) => {\n const comments = parseComment(fileContent);\n\n debugLog(`Parsing raw comments: ${JSON.stringify(comments)}`);\n\n const extensionAnnotationsComment = getClientSideExtensionAnnotations(comments);\n\n if (!extensionAnnotationsComment) {\n return null;\n }\n\n const annotations = {} as RawAnnotations;\n\n for (const { tag, name, description } of extensionAnnotationsComment.tags) {\n const annotationKey = camelCase(tag) as AnnotationKey;\n const annotationValue = [name, description].join(' ').trim();\n\n // Merge annotations of the same type\n if (MULTI_VALUE_ANNOTATIONS.includes(annotationKey)) {\n const prevValue = annotations[annotationKey];\n const wrappedPrevValue = Array.isArray(prevValue) ? (prevValue as string[]) : [];\n\n annotations[annotationKey as MultiValueAnnotationKey] = [...wrappedPrevValue, annotationValue];\n\n // eslint-disable-next-line no-continue\n continue;\n }\n\n annotations[annotationKey as SingleValueAnnotationKey] = annotationValue;\n }\n\n return annotations;\n};\n\nexport default transformComment;\n"]}
package/dist/cjs/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debugLog = exports.isNotNullOrUndefined = exports.isNotNull = exports.replaceKey = exports.isPageExtension = exports.getKeyValue = void 0;
3
+ exports.replaceKey = exports.isPageExtension = exports.getKeyValue = void 0;
4
+ exports.isNotNull = isNotNull;
5
+ exports.isNotNullOrUndefined = isNotNullOrUndefined;
6
+ exports.debugLog = debugLog;
4
7
  // Utility helper that can be used to read property from an object and provide typing
5
8
  const getKeyValue = (obj, key) => obj[key];
6
9
  exports.getKeyValue = getKeyValue;
@@ -14,16 +17,13 @@ exports.replaceKey = replaceKey;
14
17
  function isNotNull(input) {
15
18
  return input != null;
16
19
  }
17
- exports.isNotNull = isNotNull;
18
20
  function isNotNullOrUndefined(input) {
19
21
  return input !== undefined && input != null;
20
22
  }
21
- exports.isNotNullOrUndefined = isNotNullOrUndefined;
22
23
  function debugLog(message) {
23
24
  if (process.env.CSE_DEBUG) {
24
25
  // eslint-disable-next-line prefer-rest-params,no-console
25
26
  console.debug(message);
26
27
  }
27
28
  }
28
- exports.debugLog = debugLog;
29
29
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":";;;AAEA,qFAAqF;AAC9E,MAAM,WAAW,GAAG,CAAuB,GAAM,EAAE,GAAM,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAAjE,QAAA,WAAW,eAAsD;AAEvE,MAAM,eAAe,GAAG,CAAC,OAAoC,EAAW,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAA9F,QAAA,eAAe,mBAA+E;AAE3G,MAAM,SAAS,GAAG,QAAQ,CAAC;AACpB,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IACnD,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF,SAAgB,SAAS,CAAI,KAAe;IACxC,OAAO,KAAK,IAAI,IAAI,CAAC;AACzB,CAAC;AAFD,8BAEC;AAED,SAAgB,oBAAoB,CAAI,KAA2B;IAC/D,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC;AAChD,CAAC;AAFD,oDAEC;AAED,SAAgB,QAAQ,CAAC,OAAe;IACpC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE;QACvB,yDAAyD;QACzD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;AACL,CAAC;AALD,4BAKC","sourcesContent":["import type { ClientsideExtensionsOptions } from './types';\n\n// Utility helper that can be used to read property from an object and provide typing\nexport const getKeyValue = <T, K extends keyof T>(obj: T, key: K) => obj[key];\n\nexport const isPageExtension = (options: ClientsideExtensionsOptions): boolean => Boolean(options.pageUrl);\n\nconst KEY_REGEX = /\\$key/g;\nexport const replaceKey = (str: string, key: string) => {\n return str.replace(KEY_REGEX, key);\n};\n\nexport function isNotNull<T>(input: null | T): input is T {\n return input != null;\n}\n\nexport function isNotNullOrUndefined<T>(input: null | undefined | T): input is T {\n return input !== undefined && input != null;\n}\n\nexport function debugLog(message: String): void {\n if (process.env.CSE_DEBUG) {\n // eslint-disable-next-line prefer-rest-params,no-console\n console.debug(message);\n }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":";;;AAYA,8BAEC;AAED,oDAEC;AAED,4BAKC;AAvBD,qFAAqF;AAC9E,MAAM,WAAW,GAAG,CAAuB,GAAM,EAAE,GAAM,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAAjE,QAAA,WAAW,eAAsD;AAEvE,MAAM,eAAe,GAAG,CAAC,OAAoC,EAAW,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAA9F,QAAA,eAAe,mBAA+E;AAE3G,MAAM,SAAS,GAAG,QAAQ,CAAC;AACpB,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IACnD,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF,SAAgB,SAAS,CAAI,KAAe;IACxC,OAAO,KAAK,IAAI,IAAI,CAAC;AACzB,CAAC;AAED,SAAgB,oBAAoB,CAAI,KAA2B;IAC/D,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,CAAC;AAChD,CAAC;AAED,SAAgB,QAAQ,CAAC,OAAe;IACpC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACxB,yDAAyD;QACzD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACL,CAAC","sourcesContent":["import type { ClientsideExtensionsOptions } from './types';\n\n// Utility helper that can be used to read property from an object and provide typing\nexport const getKeyValue = <T, K extends keyof T>(obj: T, key: K) => obj[key];\n\nexport const isPageExtension = (options: ClientsideExtensionsOptions): boolean => Boolean(options.pageUrl);\n\nconst KEY_REGEX = /\\$key/g;\nexport const replaceKey = (str: string, key: string) => {\n return str.replace(KEY_REGEX, key);\n};\n\nexport function isNotNull<T>(input: null | T): input is T {\n return input != null;\n}\n\nexport function isNotNullOrUndefined<T>(input: null | undefined | T): input is T {\n return input !== undefined && input != null;\n}\n\nexport function debugLog(message: String): void {\n if (process.env.CSE_DEBUG) {\n // eslint-disable-next-line prefer-rest-params,no-console\n console.debug(message);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"default-parser.d.ts","sourceRoot":"","sources":["../../../lib/annotations/default-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEvE,QAAA,MAAM,gBAAgB,qBAAsB,aAAa,gCAYxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"default-parser.d.ts","sourceRoot":"","sources":["../../../lib/annotations/default-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEvE,QAAA,MAAM,gBAAgB,GAAI,CAAC,iBAAiB,aAAa,gCAYxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/annotations/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,cAAc,SAAS,CAAC;;AAExB,wBAA4C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/annotations/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,cAAc,SAAS,CAAC;wBAEE,iBAAiB;AAA3C,wBAA4C"}
@@ -1,4 +1,4 @@
1
- export declare type ConditionMap = {
1
+ export type ConditionMap = {
2
2
  [key: string]: string;
3
3
  };
4
4
  export interface RawAnnotations {
@@ -13,15 +13,15 @@ export interface RawAnnotations {
13
13
  pageUrl?: string;
14
14
  weight?: string;
15
15
  }
16
- export declare type AnnotationKey = keyof RawAnnotations;
17
- export declare type MultiValueAnnotationKey = Extract<AnnotationKey, 'condition'>;
18
- export declare type SingleValueAnnotationKey = Exclude<AnnotationKey, MultiValueAnnotationKey>;
16
+ export type AnnotationKey = keyof RawAnnotations;
17
+ export type MultiValueAnnotationKey = Extract<AnnotationKey, 'condition'>;
18
+ export type SingleValueAnnotationKey = Exclude<AnnotationKey, MultiValueAnnotationKey>;
19
19
  export interface AnnotationParserOptions {
20
20
  filePath: string;
21
21
  cwd: string;
22
22
  }
23
- export declare type AnnotationParserFunction<T = string | string[]> = (rawValue: T | undefined, rawAnnotations: RawAnnotations, options: AnnotationParserOptions) => Partial<Annotations> | null;
24
- export declare type AnnotationParsers = {
23
+ export type AnnotationParserFunction<T = string | string[]> = (rawValue: T | undefined, rawAnnotations: RawAnnotations, options: AnnotationParserOptions) => Partial<Annotations> | null;
24
+ export type AnnotationParsers = {
25
25
  [key in AnnotationKey]: AnnotationParserFunction;
26
26
  };
27
27
  /** Parsed annotations */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/annotations/types.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,cAAc;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,aAAa,GAAG,MAAM,cAAc,CAAC;AAEjD,oBAAY,uBAAuB,GAAG,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AAE1E,oBAAY,wBAAwB,GAAG,OAAO,CAAC,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4
- export declare const renderElement: (name: string, attributes: Attributes | string | null, children?: string | string[] | undefined) => string;
5
- declare type Param = {
4
+ export declare const renderElement: (name: string, attributes: Attributes | string | null, children?: string | string[]) => string;
5
+ type Param = {
6
6
  attributes: Attributes;
7
7
  value: string | string[];
8
8
  };
9
- export declare type Condition = {
9
+ export type Condition = {
10
10
  conditions?: Condition[];
11
11
  type: string;
12
12
  invert: boolean;
13
13
  class: string;
14
14
  params: Param[];
15
15
  };
16
- export declare const renderCondition: (condition?: Condition | Condition[] | null | undefined) => string;
16
+ export declare const renderCondition: (condition?: null | Condition | Condition[]) => string;
17
17
  export {};
18
18
  //# sourceMappingURL=xml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../lib/generator/xml.ts"],"names":[],"mappings":"AAAA,aAAK,UAAU,GAAG;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAClC,CAAC;AAkBF,eAAO,MAAM,aAAa,SAAU,MAAM,cAAc,UAAU,GAAG,MAAM,GAAG,IAAI,qDAYjF,CAAC;AAEF,aAAK,KAAK,GAAG;IACT,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,CAAC;AAQF,oBAAY,SAAS,GAAG;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,CAAC;CACnB,CAAC;AACF,eAAO,MAAM,eAAe,8DAAiD,MAmB5E,CAAC"}
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../lib/generator/xml.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAClC,CAAC;AAkBF,eAAO,MAAM,aAAa,SAAU,MAAM,cAAc,UAAU,GAAG,MAAM,GAAG,IAAI,aAAa,MAAM,GAAG,MAAM,EAAE,WAY/G,CAAC;AAEF,KAAK,KAAK,GAAG;IACT,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,CAAC;AAQF,MAAM,MAAM,SAAS,GAAG;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,CAAC;CACnB,CAAC;AACF,eAAO,MAAM,eAAe,eAAgB,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,KAAG,MAmB5E,CAAC"}
@@ -31,7 +31,7 @@ export interface IWrmPluginOptions {
31
31
  webresourceKeyMap: object;
32
32
  xmlDescriptors: string;
33
33
  }
34
- export declare type Entries<T> = T extends ArrayLike<infer U> ? [string, U][] : {
34
+ export type Entries<T> = T extends ArrayLike<infer U> ? [string, U][] : {
35
35
  [K in keyof T]: [K, T[K]];
36
36
  }[keyof T][];
37
37
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,4BAA6B,SAAQ,WAAW;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,2BAA4B,SAAQ,4BAA4B;IAC7E,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IAEnB,4FAA4F;IAC5F,uBAAuB,EAAE,MAAM,CAAC;IAEhC,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;I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AElD,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,CAExD;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,CAE/E;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAK9C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAa,CAAC;AAE9E,eAAO,MAAM,eAAe,YAAa,2BAA2B,KAAG,OAAmC,CAAC;AAG3G,eAAO,MAAM,UAAU,QAAS,MAAM,OAAO,MAAM,WAElD,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,CAExD;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,CAE/E;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAK9C"}
package/jest.config.js CHANGED
@@ -6,12 +6,3 @@ module.exports = {
6
6
  displayName: pack.name,
7
7
  watchPathIgnorePatterns: ['<rootDir>/lib/__fixtures__/target'],
8
8
  };
9
-
10
- if (process.env.WEBPACK_4) {
11
- module.exports.cacheDirectory = 'node_modules/.cache/jest-cache-webpack-4';
12
- module.exports.moduleNameMapper = {
13
- ...module.exports.moduleNameMapper,
14
- '^webpack((\\/.*)?)$': 'webpack-4$1',
15
- '^atlassian-webresource-webpack-plugin((\\/.*)?)$': 'atlassian-webresource-webpack-plugin-4$1',
16
- };
17
- }
@@ -1,13 +1,11 @@
1
- import { mocked } from 'ts-jest/utils';
1
+ import WrmPlugin from '@atlassian/webresource-webpack-plugin';
2
+ import { mocked } from 'jest-mock';
2
3
  import path from 'path';
3
4
  import type { Stats } from 'webpack';
4
- import WrmPlugin from 'atlassian-webresource-webpack-plugin';
5
+ import { webpack } from 'webpack';
6
+ import Plugin from './ClientsideExtensionsWebpackPlugin';
5
7
  import { fileContent } from './tests/test-helper';
6
8
 
7
- // eslint-disable-next-line import/order
8
- import webpack = require('webpack');
9
- import Plugin = require('./ClientsideExtensionsWebpackPlugin');
10
-
11
9
  const inputDir = path.resolve(__dirname, '__fixtures__/basic/');
12
10
  const outputDir = path.resolve(__dirname, '__fixtures__/target/');
13
11
 
@@ -1,14 +1,12 @@
1
- import type { Stats } from 'webpack';
2
- import { promisify } from 'util';
1
+ import WrmPlugin from '@atlassian/webresource-webpack-plugin';
2
+ import { mocked } from 'jest-mock';
3
3
  import path from 'path';
4
- import WrmPlugin from 'atlassian-webresource-webpack-plugin';
5
- import { mocked } from 'ts-jest/utils';
6
- // eslint-disable-next-line import/order
7
- import webpack = require('webpack');
4
+ import { promisify } from 'util';
5
+ import type { Configuration, Stats } from 'webpack';
6
+ import { webpack } from 'webpack';
7
+ import Plugin from './ClientsideExtensionsWebpackPlugin';
8
8
  import { fileContent, getOutputContentAsJson } from './tests/test-helper';
9
9
 
10
- import Plugin = require('./ClientsideExtensionsWebpackPlugin');
11
-
12
10
  const PLUGIN_KEY = 'a.fake.plugin.key';
13
11
 
14
12
  beforeAll(() => {
@@ -211,7 +209,7 @@ describe('condition compilation errors', () => {
211
209
  return webpackConfig;
212
210
  };
213
211
 
214
- const compile = (config: webpack.Configuration): Promise<Stats> => {
212
+ const compile = (config: Configuration): Promise<Stats> => {
215
213
  const compiler = webpack(config);
216
214
 
217
215
  return new Promise<Stats>((resolve, reject) => {
@@ -1,12 +1,10 @@
1
- import { resolve, join } from 'path';
2
- import WrmPlugin from 'atlassian-webresource-webpack-plugin';
3
- import { mocked } from 'ts-jest/utils';
1
+ import WrmPlugin from '@atlassian/webresource-webpack-plugin';
2
+ import { mocked } from 'jest-mock';
3
+ import { join, resolve } from 'path';
4
+ import { webpack } from 'webpack';
5
+ import Plugin from './ClientsideExtensionsWebpackPlugin';
4
6
  import { fileContent } from './tests/test-helper';
5
7
 
6
- // eslint-disable-next-line import/order
7
- import webpack = require('webpack');
8
- import Plugin = require('./ClientsideExtensionsWebpackPlugin');
9
-
10
8
  const inputDir = resolve(__dirname, '__fixtures__/metadata/');
11
9
  const outputDir = resolve(__dirname, '__fixtures__/target/');
12
10
 
@@ -218,7 +218,7 @@ class ClientsideExtensionsWebpackPlugin {
218
218
 
219
219
  if (!wrmPlugin) {
220
220
  throw new Error(
221
- `Can't find the WrmPlugin. Make sure you are using this plugin only in conjunction with the atlassian-webresource-webpack-plugin`,
221
+ `Can't find the WrmPlugin. Make sure you are using this plugin only in conjunction with the @atlassian/webresource-webpack-plugin`,
222
222
  );
223
223
  }
224
224
 
@@ -1,12 +1,10 @@
1
- import type { Stats } from 'webpack';
1
+ import WrmPlugin from '@atlassian/webresource-webpack-plugin';
2
+ import { mocked } from 'jest-mock';
2
3
  import path from 'path';
3
- import WrmPlugin from 'atlassian-webresource-webpack-plugin';
4
- import { mocked } from 'ts-jest/utils';
5
- // eslint-disable-next-line import/order
6
- import webpack = require('webpack');
7
- import { getOutputContentAsJson, fileContent } from './tests/test-helper';
8
-
9
- import Plugin = require('./ClientsideExtensionsWebpackPlugin');
4
+ import type { Configuration, Stats } from 'webpack';
5
+ import { webpack } from 'webpack';
6
+ import Plugin from './ClientsideExtensionsWebpackPlugin';
7
+ import { fileContent, getOutputContentAsJson } from './tests/test-helper';
10
8
 
11
9
  const { PAGE_DATA_PROVIDER_DATA_KEY } = require('./generator/webpageDescriptor');
12
10
 
@@ -477,7 +475,7 @@ describe('webpages compilation errors', () => {
477
475
  return webpackConfig;
478
476
  };
479
477
 
480
- const compile = (config: webpack.Configuration): Promise<Stats> => {
478
+ const compile = (config: Configuration): Promise<Stats> => {
481
479
  const compiler = webpack(config);
482
480
 
483
481
  return new Promise<Stats>((resolve, reject) => {
@@ -4,6 +4,6 @@ class IWrmPlugin {
4
4
  apply(compiler: unknown): void;
5
5
  }
6
6
 
7
- declare module 'atlassian-webresource-webpack-plugin' {
7
+ declare module '@atlassian/webresource-webpack-plugin' {
8
8
  export default IWrmPlugin;
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlassian/clientside-extensions-webpack-plugin",
3
- "version": "5.0.0",
3
+ "version": "5.1.0-9864e593-me132vr9",
4
4
  "description": "Allows for simple creation of client-side extensions",
5
5
  "main": "./dist/cjs/ClientsideExtensionsWebpackPlugin.js",
6
6
  "types": "./dist/types/ClientsideExtensionsWebpackPlugin.d.ts",
@@ -13,7 +13,6 @@
13
13
  "verify": "tsc --noEmit -p tsconfig.all.json",
14
14
  "watch": "tsc --watch",
15
15
  "test": "jest",
16
- "test:webpack4": "env NODE_OPTIONS=--openssl-legacy-provider WEBPACK_4=true jest",
17
16
  "test:watch": "jest --watch"
18
17
  },
19
18
  "repository": {
@@ -56,7 +55,7 @@
56
55
  ],
57
56
  "publishConfig": {
58
57
  "access": "public",
59
- "@atlassian:registry": "https://registry.npmjs.org/"
58
+ "@atlassian:registry": "https://packages.atlassian.com/api/npm/npm-public/"
60
59
  },
61
60
  "dependencies": {
62
61
  "comment-parser": "~1.3.0",
@@ -68,24 +67,24 @@
68
67
  },
69
68
  "peerDependencies": {
70
69
  "@atlassian/clientside-extensions-registry": "*",
71
- "atlassian-webresource-webpack-plugin": "^4.9.0 || ^5.0.0 || ^6.0.0",
72
- "webpack": "^4.0.0 || ^5.0.0"
70
+ "@atlassian/webresource-webpack-plugin": "^7.0.3",
71
+ "webpack": "^5.0.0"
73
72
  },
74
73
  "devDependencies": {
75
- "@atlassian/clientside-extensions": "^5.0.0",
76
- "@atlassian/clientside-extensions-registry": "^5.0.0",
74
+ "@atlassian/clientside-extensions": "^5.1.0-9864e593-me132vr9",
75
+ "@atlassian/clientside-extensions-registry": "^5.1.0-9864e593-me132vr9",
76
+ "@atlassian/webresource-webpack-plugin": "^7.0.3",
77
77
  "@types/lodash": "4.14.177",
78
78
  "@types/webpack": "5.28.0",
79
- "atlassian-webresource-webpack-plugin": "6.0.3",
80
- "atlassian-webresource-webpack-plugin-4": "npm:atlassian-webresource-webpack-plugin@4.9.0",
81
79
  "cpy-cli": "3.1.1",
82
80
  "fast-xml-parser": "3.21.1",
83
- "ts-jest": "27.0.7",
81
+ "jest-mock": "30.0.5",
82
+ "ts-jest": "29.4.1",
84
83
  "webpack": "5.64.4",
85
84
  "webpack-4": "npm:webpack@4.46.0"
86
85
  },
87
86
  "engines": {
88
- "node": ">=20.16.0"
87
+ "node": ">=20.18.1"
89
88
  },
90
- "gitHead": "797ed863b536adc5806a0f9438ee9501d710a467"
89
+ "gitHead": "9864e5937d68e51d7a26eece1238be16589135b5"
91
90
  }