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