@atlassian/atlassian-connect-js 5.3.190
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/.depcheckrc.json +16 -0
- package/.editorconfig +9 -0
- package/.envrc +5 -0
- package/.eslintignore +12 -0
- package/.eslintrc +31 -0
- package/.husky/pre-commit +11 -0
- package/.lintstagedrc.js +6 -0
- package/.netrc +1 -0
- package/.npmrc-public +4 -0
- package/.nvmrc +1 -0
- package/LICENSE +3 -0
- package/README.md +281 -0
- package/bitbucket-pipelines.yml +33 -0
- package/build/bin/bin-helper.js +29 -0
- package/build/bin/npm-postinstall.js +9 -0
- package/build/configs/append-sourcemapping.js +13 -0
- package/build/configs/availabletasks.js +15 -0
- package/build/configs/clean.js +12 -0
- package/build/configs/concat.js +44 -0
- package/build/configs/copy.js +32 -0
- package/build/configs/index.js +19 -0
- package/build/configs/jshint.js +9 -0
- package/build/configs/karma.js +11 -0
- package/build/configs/replace.js +10 -0
- package/build/configs/requirejs.js +187 -0
- package/build/configs/saucelabs-launchers.js +30 -0
- package/build/configs/shell.js +24 -0
- package/build/configs/uglify.js +15 -0
- package/build/configs/watch.js +45 -0
- package/build/end.frag +13 -0
- package/build/start.frag +18 -0
- package/bundlesize.config.json +14 -0
- package/dist/connect-host.css +225 -0
- package/dist/connect-host.js +13908 -0
- package/dist/connect-host.min.css +1 -0
- package/dist/iframe-fedramp.js +13663 -0
- package/dist/iframe.js +13663 -0
- package/dist/legacy-text-colors.css +245 -0
- package/dist/surfaces.css +11 -0
- package/dist/themes/atlaskit-tokens_dark-future.css +6 -0
- package/dist/themes/atlaskit-tokens_dark.css +394 -0
- package/dist/themes/atlaskit-tokens_legacy-dark.css +394 -0
- package/dist/themes/atlaskit-tokens_legacy-light.css +394 -0
- package/dist/themes/atlaskit-tokens_light-future.css +6 -0
- package/dist/themes/atlaskit-tokens_light.css +394 -0
- package/dist/themes/atlaskit-tokens_shape.css +14 -0
- package/dist/themes/atlaskit-tokens_spacing.css +26 -0
- package/dist/themes/atlaskit-tokens_typography-adg3.css +25 -0
- package/dist/themes/atlaskit-tokens_typography-modernized.css +25 -0
- package/dist/themes/atlaskit-tokens_typography-refreshed.css +25 -0
- package/gulpfile.js +204 -0
- package/memleak-check/app.html +10 -0
- package/memleak-check/index.html +31 -0
- package/memleak-check/index.js +33 -0
- package/package.json +102 -0
- package/renovate.json +11 -0
- package/security-assistant.yml +2 -0
- package/spec/.eslintrc +10 -0
- package/spec/config/karma.base.conf.js +200 -0
- package/spec/config/karma.conf.js +20 -0
- package/spec/fixtures/base_dialog_component_tests.js +180 -0
- package/spec/mocks/mock_feature_flag.js +23 -0
- package/spec/tests/amd_spec.js +122 -0
- package/spec/tests/analytics_dispatcher_spec.js +429 -0
- package/spec/tests/analytics_performance_spec.js +41 -0
- package/spec/tests/button_spec.js +143 -0
- package/spec/tests/dialog_extension_spec.js +59 -0
- package/spec/tests/dialog_module_provider_spec.js +499 -0
- package/spec/tests/dialog_module_spec.js +395 -0
- package/spec/tests/dialog_spec.js +296 -0
- package/spec/tests/dialog_webitem_spec.js +183 -0
- package/spec/tests/dropdown_module_spec.js +77 -0
- package/spec/tests/env_module_spec.js +153 -0
- package/spec/tests/events_spec.js +77 -0
- package/spec/tests/extension_configuration_options_store_spec.js +25 -0
- package/spec/tests/flag_module_provider_spec.js +79 -0
- package/spec/tests/flag_module_spec.js +118 -0
- package/spec/tests/flag_spec.js +243 -0
- package/spec/tests/host-api_spec.js +220 -0
- package/spec/tests/iframe-create_spec.js +43 -0
- package/spec/tests/iframe_container_spec.js +19 -0
- package/spec/tests/iframe_spec.js +265 -0
- package/spec/tests/inline_dialog_spec.js +41 -0
- package/spec/tests/inline_dialog_webitem_spec.js +331 -0
- package/spec/tests/loading_indicator_spec.js +48 -0
- package/spec/tests/messages_module_spec.js +108 -0
- package/spec/tests/meta_spec.js +71 -0
- package/spec/tests/module_args_spec.js +52 -0
- package/spec/tests/observe_spec.js +73 -0
- package/spec/tests/public_events.spec.js +102 -0
- package/spec/tests/scroll_position_spec.js +109 -0
- package/spec/tests/theming_spec.js +594 -0
- package/spec/tests/util_spec.js +55 -0
- package/spec/tests/utils/base64_spec.js +20 -0
- package/spec/tests/utils/button_spec.js +11 -0
- package/spec/tests/utils/cookie_spec.js +19 -0
- package/spec/tests/utils/deprecate_spec.js +22 -0
- package/spec/tests/utils/dialog_spec.js +297 -0
- package/spec/tests/utils/host_util_spec.js +45 -0
- package/spec/tests/utils/iframe_spec.js +41 -0
- package/spec/tests/utils/jwt_spec.js +135 -0
- package/spec/tests/utils/url_spec.js +37 -0
- package/spec/tests/utils/waitUntilReadyNextTick.js +5 -0
- package/spec/tests/utils/webitem.js +219 -0
- package/spec/tests/webitem_spec.js +131 -0
- package/src/css/host/dialog.css +144 -0
- package/src/css/host/flags.css +5 -0
- package/src/css/host/host.css +64 -0
- package/src/css/host/messages.css +12 -0
- package/src/css/plugin/legacy-text-colors.less +55 -0
- package/src/css/plugin/surfaces.css +11 -0
- package/src/host/ACJSFrameworkAdaptor.js +44 -0
- package/src/host/actions/analytics_action.js +35 -0
- package/src/host/actions/button_actions.js +21 -0
- package/src/host/actions/dialog_actions.js +27 -0
- package/src/host/actions/dialog_extension_actions.js +25 -0
- package/src/host/actions/dom_event_actions.js +32 -0
- package/src/host/actions/dropdown_actions.js +12 -0
- package/src/host/actions/env_actions.js +57 -0
- package/src/host/actions/event_actions.js +33 -0
- package/src/host/actions/flag_actions.js +22 -0
- package/src/host/actions/iframe_actions.js +27 -0
- package/src/host/actions/inline_dialog_actions.js +26 -0
- package/src/host/actions/inline_dialog_webitem_actions.js +10 -0
- package/src/host/actions/jwt_actions.js +51 -0
- package/src/host/actions/loading_indicator_actions.js +10 -0
- package/src/host/actions/module_actions.js +14 -0
- package/src/host/actions/webitem_actions.js +29 -0
- package/src/host/components/button.js +112 -0
- package/src/host/components/dialog.js +447 -0
- package/src/host/components/dialog_extension.js +106 -0
- package/src/host/components/dialog_webitem.js +69 -0
- package/src/host/components/flag.js +102 -0
- package/src/host/components/iframe.js +130 -0
- package/src/host/components/iframe_container.js +38 -0
- package/src/host/components/inline_dialog.js +108 -0
- package/src/host/components/inline_dialog_webitem.js +157 -0
- package/src/host/components/loading_indicator.js +110 -0
- package/src/host/components/webitem.js +227 -0
- package/src/host/deprecate.js +20 -0
- package/src/host/dispatchers/analytics_dispatcher.js +512 -0
- package/src/host/dispatchers/event_dispatcher.js +46 -0
- package/src/host/dollar.js +8 -0
- package/src/host/host-api.js +325 -0
- package/src/host/iframe-create.js +7 -0
- package/src/host/index.js +108 -0
- package/src/host/module-providers.js +13 -0
- package/src/host/modules/_featureFlag.js +42 -0
- package/src/host/modules/_performance.js +54 -0
- package/src/host/modules/analytics.js +17 -0
- package/src/host/modules/dialog.js +496 -0
- package/src/host/modules/dropdown.js +255 -0
- package/src/host/modules/env.js +156 -0
- package/src/host/modules/events.js +28 -0
- package/src/host/modules/flag.js +170 -0
- package/src/host/modules/host.js +19 -0
- package/src/host/modules/inline-dialog.js +33 -0
- package/src/host/modules/messages.js +309 -0
- package/src/host/modules/page.js +29 -0
- package/src/host/modules/scroll-position.js +102 -0
- package/src/host/modules/theming.js +114 -0
- package/src/host/stores/extension_configuration_options_store.js +24 -0
- package/src/host/util.js +98 -0
- package/src/host/utils/access-narrowing-context.js +18 -0
- package/src/host/utils/base64.js +22 -0
- package/src/host/utils/button.js +10 -0
- package/src/host/utils/cookie.js +14 -0
- package/src/host/utils/dialog.js +239 -0
- package/src/host/utils/feature-flag.js +27 -0
- package/src/host/utils/iframe.js +23 -0
- package/src/host/utils/jwt.js +60 -0
- package/src/host/utils/observe.js +34 -0
- package/src/host/utils/removal-observer.js +30 -0
- package/src/host/utils/simplexdm.js +58 -0
- package/src/host/utils/url.js +23 -0
- package/src/host/utils/webitem.js +214 -0
- package/src/plugin/amd.js +115 -0
- package/src/plugin/analytics.js +84 -0
- package/src/plugin/deprecate.js +16 -0
- package/src/plugin/dialog.js +197 -0
- package/src/plugin/dollar.js +77 -0
- package/src/plugin/events-instance.js +2 -0
- package/src/plugin/events.js +246 -0
- package/src/plugin/extension_configuration_options_store.js +27 -0
- package/src/plugin/featureFlag.js +8 -0
- package/src/plugin/index.js +118 -0
- package/src/plugin/meta.js +14 -0
- package/src/plugin/public-events.js +73 -0
- package/src/plugin/theming.js +211 -0
- package/src/plugin/util.js +104 -0
package/gulpfile.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const gulp = require('gulp');
|
|
4
|
+
const watch = require('gulp-watch');
|
|
5
|
+
const concat = require('gulp-concat');
|
|
6
|
+
const cleanCSS = require('gulp-clean-css');
|
|
7
|
+
const less = require('gulp-less');
|
|
8
|
+
const merge = require('merge-stream');
|
|
9
|
+
const { argv } = require('yargs');
|
|
10
|
+
const rollup = require('rollup');
|
|
11
|
+
const { babel } = require('@rollup/plugin-babel');
|
|
12
|
+
const commonjs = require('@rollup/plugin-commonjs');
|
|
13
|
+
const { nodeResolve } = require('@rollup/plugin-node-resolve');
|
|
14
|
+
const builtins = require('rollup-plugin-node-builtins');
|
|
15
|
+
const replace = require('@rollup/plugin-replace');
|
|
16
|
+
const { visualizer } = require('rollup-plugin-visualizer');
|
|
17
|
+
const { getThemeStyles } = require('@atlaskit/tokens');
|
|
18
|
+
|
|
19
|
+
const deployPath = argv.deployPath || '../atlassian-connect/jsapi-v5/src/main/resources/v5';
|
|
20
|
+
const dest = 'dist';
|
|
21
|
+
const commercialCdnDomain = 'connect-cdn.atl-paas.net';
|
|
22
|
+
const fedrampCdnDomain = 'connect-alljs-cdn-bifrost.frontend.cdn.atlassian-us-gov-mod.com/assets';
|
|
23
|
+
|
|
24
|
+
function build(entryModule, distModule, options) {
|
|
25
|
+
// Required for transform-inline-environment-variables plugin
|
|
26
|
+
process.env.NODE_ENV = 'production'
|
|
27
|
+
process.env.CDN_DOMAIN = options.isFedRAMP ? fedrampCdnDomain : commercialCdnDomain;
|
|
28
|
+
|
|
29
|
+
const fileName = distModule + (options.isFedRAMP ? '-fedramp' : '') + '.js';
|
|
30
|
+
|
|
31
|
+
return rollup.rollup({
|
|
32
|
+
input: entryModule,
|
|
33
|
+
plugins: [
|
|
34
|
+
{
|
|
35
|
+
name: 'output-theme-css',
|
|
36
|
+
generateBundle: async function (outputOptions, bundle) {
|
|
37
|
+
const themeStyles = await getThemeStyles('all');
|
|
38
|
+
|
|
39
|
+
themeStyles.map(({ id, css }) => {
|
|
40
|
+
this.emitFile({
|
|
41
|
+
type: 'asset',
|
|
42
|
+
fileName: `themes/atlaskit-tokens_${id}.css`,
|
|
43
|
+
source: css,
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
babel({
|
|
49
|
+
exclude: new RegExp('node_modules\/(promise\-polyfill|query\-string)'),
|
|
50
|
+
plugins: [
|
|
51
|
+
'@babel/plugin-transform-runtime',
|
|
52
|
+
// Stage 2
|
|
53
|
+
['@babel/plugin-proposal-decorators', { 'legacy': true }],
|
|
54
|
+
'transform-inline-environment-variables'
|
|
55
|
+
],
|
|
56
|
+
presets: [
|
|
57
|
+
['@babel/preset-env', {
|
|
58
|
+
'targets': {
|
|
59
|
+
'browsers': [
|
|
60
|
+
'last 1 Chrome versions',
|
|
61
|
+
'last 1 Firefox versions',
|
|
62
|
+
'last 1 Safari versions',
|
|
63
|
+
'Explorer 11',
|
|
64
|
+
'last 1 Edge versions'
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
'modules': false,
|
|
68
|
+
'useBuiltIns': false,
|
|
69
|
+
'loose': true,
|
|
70
|
+
'debug': true
|
|
71
|
+
}]
|
|
72
|
+
],
|
|
73
|
+
babelHelpers: 'runtime'
|
|
74
|
+
}),
|
|
75
|
+
builtins(),
|
|
76
|
+
nodeResolve({
|
|
77
|
+
jsnext: true,
|
|
78
|
+
main: true,
|
|
79
|
+
browser: true,
|
|
80
|
+
preferBuiltins: false
|
|
81
|
+
}),
|
|
82
|
+
commonjs({
|
|
83
|
+
// ignoreGlobal: true,
|
|
84
|
+
include: 'node_modules/**'
|
|
85
|
+
}),
|
|
86
|
+
replace({
|
|
87
|
+
delimiters: [ '%%', '%%' ],
|
|
88
|
+
preventAssignment: true,
|
|
89
|
+
GULP_INJECT_VERSION: JSON.parse(fs.readFileSync('package.json', 'utf8')).version
|
|
90
|
+
}),
|
|
91
|
+
// https://github.com/btd/rollup-plugin-visualizer#options
|
|
92
|
+
visualizer({
|
|
93
|
+
filename: `reports/stats-${distModule || 'default'}.html`,
|
|
94
|
+
gzipSize: true,
|
|
95
|
+
open: false
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
}).then(function (bundle) {
|
|
99
|
+
return bundle.write({
|
|
100
|
+
indent: true,
|
|
101
|
+
format: options.format || 'umd',
|
|
102
|
+
name: options.standalone || distModule,
|
|
103
|
+
file: './dist/' + fileName,
|
|
104
|
+
inlineDynamicImports: true
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function buildPlugin() {
|
|
110
|
+
return build('src/plugin/index.js', 'iframe', {
|
|
111
|
+
standalone: 'AP',
|
|
112
|
+
env: {ENV: 'plugin'},
|
|
113
|
+
format: 'iife'
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function buildFedrampPlugin() {
|
|
118
|
+
return build('src/plugin/index.js', 'iframe', {
|
|
119
|
+
standalone: 'AP',
|
|
120
|
+
env: {ENV: 'plugin'},
|
|
121
|
+
format: 'iife',
|
|
122
|
+
isFedRAMP: true
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function watchPlugin() {
|
|
127
|
+
return watch('src/plugin/**/*.js', {
|
|
128
|
+
name: 'Plugin watcher',
|
|
129
|
+
ignoreInitial: false
|
|
130
|
+
}, buildPlugin);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function buildHost() {
|
|
134
|
+
return build('src/host/index.js', 'connect-host', {
|
|
135
|
+
standalone: 'connectHost',
|
|
136
|
+
env: {ENV: 'host'}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function watchHost() {
|
|
141
|
+
return watch('src/host/**/*.js', {
|
|
142
|
+
name: 'Host watcher',
|
|
143
|
+
ignoreInitial: false
|
|
144
|
+
}, buildHost);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function clean(cb) {
|
|
148
|
+
fs.rmSync(dest, { recursive: true });
|
|
149
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
150
|
+
cb();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function buildCss(options) {
|
|
154
|
+
options = options || {};
|
|
155
|
+
options.dest = options.dest || 'dist';
|
|
156
|
+
|
|
157
|
+
gulp
|
|
158
|
+
.src('src/css/plugin/surfaces.css')
|
|
159
|
+
.pipe(gulp.dest(options.dest));
|
|
160
|
+
|
|
161
|
+
gulp
|
|
162
|
+
.src('src/css/plugin/**/*.less')
|
|
163
|
+
.pipe(less())
|
|
164
|
+
.pipe(gulp.dest(options.dest));
|
|
165
|
+
|
|
166
|
+
var g = gulp.src('src/css/host/**/*.css')
|
|
167
|
+
.pipe(concat('connect-host.css'))
|
|
168
|
+
.pipe(gulp.dest(options.dest));
|
|
169
|
+
|
|
170
|
+
if(options.minify){
|
|
171
|
+
g.pipe(concat('connect-host.min.css'))
|
|
172
|
+
.pipe(cleanCSS())
|
|
173
|
+
.pipe(gulp.dest(options.dest));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return g;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function deploy() {
|
|
180
|
+
return merge(
|
|
181
|
+
gulp.src('./dist/**/*.js')
|
|
182
|
+
.pipe(gulp.dest(`${deployPath}/js/core`)),
|
|
183
|
+
gulp.src('dist/**/*.css')
|
|
184
|
+
.pipe(gulp.dest(`${deployPath}/css/core`))
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
gulp.task('plugin:build', buildPlugin);
|
|
189
|
+
gulp.task('plugin:build:fedramp', buildFedrampPlugin);
|
|
190
|
+
gulp.task('plugin:watch', watchPlugin);
|
|
191
|
+
|
|
192
|
+
gulp.task('host:build', buildHost);
|
|
193
|
+
gulp.task('host:watch', watchHost);
|
|
194
|
+
|
|
195
|
+
gulp.task('clean', clean);
|
|
196
|
+
gulp.task('css:build', buildCss);
|
|
197
|
+
gulp.task('css:minify', buildCss.bind(null, {minify: true}));
|
|
198
|
+
|
|
199
|
+
gulp.task('watch', gulp.series(['plugin:watch', 'host:watch']));
|
|
200
|
+
gulp.task('build', gulp.series(['plugin:build', 'plugin:build:fedramp', 'host:build']));
|
|
201
|
+
|
|
202
|
+
gulp.task('deploy', deploy);
|
|
203
|
+
|
|
204
|
+
gulp.task('default', gulp.series(['clean', 'build', 'css:minify']));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title></title>
|
|
4
|
+
<script src="http://code.jquery.com/jquery-2.2.4.min.js"></script>
|
|
5
|
+
<script>
|
|
6
|
+
window.AJS = {
|
|
7
|
+
$: window.$
|
|
8
|
+
};
|
|
9
|
+
</script>
|
|
10
|
+
<script src="connect-host.js"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<script>
|
|
14
|
+
connectHost.onIframeEstablished(function (data) {
|
|
15
|
+
setTimeout(function () {
|
|
16
|
+
data.$el.closest('.ap-iframe-container').remove();
|
|
17
|
+
}, 0);
|
|
18
|
+
});
|
|
19
|
+
connectHost.onIframeUnload(function (data) {
|
|
20
|
+
connectHost.destroy(data.extension.id);
|
|
21
|
+
});
|
|
22
|
+
function loadAndRemoveAppIframe() {
|
|
23
|
+
$('body').append(connectHost.create({
|
|
24
|
+
addon_key: 'test',
|
|
25
|
+
key: 'test',
|
|
26
|
+
url: window.origin + '/app.html'
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
const drool = require('drool');
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
const httpServer = require('http-server');
|
|
5
|
+
const { argv } = require('yargs');
|
|
6
|
+
const server = httpServer.createServer();
|
|
7
|
+
const driver = drool.start({
|
|
8
|
+
chromeOptions: ['no-sandbox', 'headless']
|
|
9
|
+
});
|
|
10
|
+
const MAX_LEAK = 750000;
|
|
11
|
+
const port = argv.port ? parseInt(argv.port) : 8080;
|
|
12
|
+
|
|
13
|
+
server.listen(port);
|
|
14
|
+
drool.flow({
|
|
15
|
+
repeatCount: 1000,
|
|
16
|
+
setup: function() {
|
|
17
|
+
driver.get(`http://localhost:${port}/`);
|
|
18
|
+
},
|
|
19
|
+
action: function() {
|
|
20
|
+
driver.executeScript('loadAndRemoveAppIframe()');
|
|
21
|
+
},
|
|
22
|
+
assert: function(after, initial) {
|
|
23
|
+
const leak = after.counts.jsHeapSizeUsed - initial.counts.jsHeapSizeUsed;
|
|
24
|
+
console.log('initial.counts', initial.counts);
|
|
25
|
+
console.log('after.counts', after.counts);
|
|
26
|
+
assert.equal(initial.counts.nodes, after.counts.nodes, 'node count should match');
|
|
27
|
+
assert(leak < MAX_LEAK, `leak (${leak}) should be < ${MAX_LEAK}`)
|
|
28
|
+
},
|
|
29
|
+
exit: function() {
|
|
30
|
+
driver.quit();
|
|
31
|
+
server.close();
|
|
32
|
+
}
|
|
33
|
+
}, driver);
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlassian/atlassian-connect-js",
|
|
3
|
+
"version": "5.3.190",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "Atlassian Connect JavaScript bridge",
|
|
6
|
+
"main": "dist/connect-host.js",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "ssh://git@bitbucket.org:atlassian/atlassian-connect-js.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"registry": "https://packages.atlassian.com/api/npm/npm-public/"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "npx gulp",
|
|
16
|
+
"dev:build": "npx yalc publish --push",
|
|
17
|
+
"bundlesize": "bundlesize --config=bundlesize.config.json",
|
|
18
|
+
"depcheck": "depcheck --config=.depcheckrc.json",
|
|
19
|
+
"karma": "karma start spec/config/karma.conf.js",
|
|
20
|
+
"karma-ci": "npm run karma -- --single-run",
|
|
21
|
+
"lint": "eslint \"**/*.js\"",
|
|
22
|
+
"prepublish": "npm run build",
|
|
23
|
+
"test": "npm run lint && npm run karma",
|
|
24
|
+
"test-ci": "npm run lint && npm run karma-ci",
|
|
25
|
+
"test-mem": "cd memleak-check && node index",
|
|
26
|
+
"test-sl": "SAUCE_LABS=true SAUCE_USERNAME=$SAUCE_USERNAME SAUCE_ACCESS_KEY=$SAUCE_ACCESS_KEY npm run test-ci",
|
|
27
|
+
"tag": "PACKAGE_VERSION=$(node -p \"require('./package.json').version\") && git tag $PACKAGE_VERSION && git push --tags",
|
|
28
|
+
"prepare": "husky"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.23.2",
|
|
32
|
+
"@babel/plugin-proposal-decorators": "^7.23.2",
|
|
33
|
+
"@babel/plugin-transform-runtime": "^7.23.2",
|
|
34
|
+
"@babel/preset-env": "^7.23.2",
|
|
35
|
+
"@babel/runtime": "^7.23.2",
|
|
36
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
37
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
38
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
39
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
40
|
+
"@types/jasmine": "^2.5.54",
|
|
41
|
+
"@types/jquery": "^3.5.29",
|
|
42
|
+
"babel-loader": "8.0.6",
|
|
43
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
44
|
+
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
|
45
|
+
"bundlesize": "^1.0.0-beta.2",
|
|
46
|
+
"depcheck": "^1.4.2",
|
|
47
|
+
"drool": "0.6.0",
|
|
48
|
+
"envify": "3.4.1",
|
|
49
|
+
"eslint": "^8.44.0",
|
|
50
|
+
"graceful-fs": "4.1.10",
|
|
51
|
+
"gulp": "^4.0.2",
|
|
52
|
+
"gulp-clean-css": "4.3.0",
|
|
53
|
+
"gulp-concat": "2.6.0",
|
|
54
|
+
"gulp-less": "^5.0.0",
|
|
55
|
+
"gulp-watch": "^5.0.1",
|
|
56
|
+
"http-server": "0.11.1",
|
|
57
|
+
"husky": "^9.1.7",
|
|
58
|
+
"jasmine-core": "2.5.2",
|
|
59
|
+
"karma": "^6.3.9",
|
|
60
|
+
"karma-chrome-launcher": "2.0.0",
|
|
61
|
+
"karma-cli": "^2.0.0",
|
|
62
|
+
"karma-coverage": "^2.1.0",
|
|
63
|
+
"karma-html2js-preprocessor": "1.1",
|
|
64
|
+
"karma-jasmine": "1.0.2",
|
|
65
|
+
"karma-jasmine-ajax": "0.1.13",
|
|
66
|
+
"karma-jasmine-diff-reporter": "1.1.0",
|
|
67
|
+
"karma-nyan-reporter": "0.2.4",
|
|
68
|
+
"karma-phantomjs-launcher": "1.0.2",
|
|
69
|
+
"karma-safari-launcher": "1.0.0",
|
|
70
|
+
"karma-sauce-launcher": "^4.3.6",
|
|
71
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
72
|
+
"karma-webpack": "^4.0.2",
|
|
73
|
+
"less-loader": "^7.3.0",
|
|
74
|
+
"lint-staged": "^13.0.3",
|
|
75
|
+
"lodash": "4.17.21",
|
|
76
|
+
"merge-stream": "1.0.0",
|
|
77
|
+
"raw-loader": "^4.0.2",
|
|
78
|
+
"rollup": "^2.60.0",
|
|
79
|
+
"rollup-plugin-node-builtins": "2.1.2",
|
|
80
|
+
"rollup-plugin-visualizer": "^5.5.2",
|
|
81
|
+
"webpack": "^4.46.0",
|
|
82
|
+
"yargs": "6.3.0"
|
|
83
|
+
},
|
|
84
|
+
"dependencies": {
|
|
85
|
+
"@atlaskit/feature-gate-js-client": "4.23.4",
|
|
86
|
+
"@atlaskit/platform-feature-flags": "1.0.0",
|
|
87
|
+
"@atlaskit/tokens": "4.2.0",
|
|
88
|
+
"base64-js": "1.3.0",
|
|
89
|
+
"query-string": "7.1.3",
|
|
90
|
+
"simple-xdm": "^2.3.3",
|
|
91
|
+
"web-vitals": "^4.2.4"
|
|
92
|
+
},
|
|
93
|
+
"overrides": {
|
|
94
|
+
"@atlaskit/feature-gate-js-client": "4.23.4",
|
|
95
|
+
"@atlaskit/platform-feature-flags": "1.0.0",
|
|
96
|
+
"saucelabs": "8.0.0",
|
|
97
|
+
"webdriverio": "8.12.1",
|
|
98
|
+
"@babel/core": {
|
|
99
|
+
"debug@^4.1.1": "4.3.7"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
package/renovate.json
ADDED
package/spec/.eslintrc
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Karma configuration
|
|
2
|
+
// Generated on Wed Oct 16 2013 15:12:27 GMT+1100 (EST)
|
|
3
|
+
|
|
4
|
+
var envify = require('envify/custom');
|
|
5
|
+
var webpack = require('webpack');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var customLaunchers = require('../../build/configs/saucelabs-launchers');
|
|
8
|
+
var saucelabs = process.env.SAUCE_LABS || false;
|
|
9
|
+
var coverage = process.env.COVERAGE || false;
|
|
10
|
+
|
|
11
|
+
module.exports = function(config) {
|
|
12
|
+
var karmaConfig = {
|
|
13
|
+
// base path, that will be used to resolve files and exclude
|
|
14
|
+
basePath: '../../',
|
|
15
|
+
|
|
16
|
+
// frameworks to use
|
|
17
|
+
// list of files / patterns to load in the browser
|
|
18
|
+
files: [
|
|
19
|
+
'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js',
|
|
20
|
+
'https://aui-cdn.atlassian.com/aui-adg/5.9.17/js/aui.js',
|
|
21
|
+
'https://aui-cdn.atlassian.com/aui-adg/5.9.17/css/aui.min.css',
|
|
22
|
+
'https://cdn.rawgit.com/requirejs/almond/0.3.1/almond.js',
|
|
23
|
+
'https://aui-cdn.atlassian.com/aui-adg/5.9.17/js/aui-experimental.js',
|
|
24
|
+
{pattern: 'src/css/host/**', included: true, served: true}
|
|
25
|
+
// {pattern: 'fixtures/**', included: false, served: true},
|
|
26
|
+
// {pattern: 'dist/**', included: false, served: true}
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
//do not process my html files.
|
|
30
|
+
preprocessors: {
|
|
31
|
+
'spec/tests/**/*.js': ['webpack'],
|
|
32
|
+
'src/**/*.js': ['webpack', 'sourcemap']
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
webpack: {
|
|
36
|
+
mode: 'development',
|
|
37
|
+
devtool: 'inline-source-map',
|
|
38
|
+
cache: true,
|
|
39
|
+
resolve: {
|
|
40
|
+
alias: {
|
|
41
|
+
'src': path.join(__dirname, '../../src/'),
|
|
42
|
+
'fixtures': path.join(__dirname, '../fixtures/'),
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
plugins: [],
|
|
46
|
+
module: {
|
|
47
|
+
rules: [
|
|
48
|
+
{
|
|
49
|
+
test: /\.js$/,
|
|
50
|
+
use: {
|
|
51
|
+
loader: 'babel-loader',
|
|
52
|
+
options: {
|
|
53
|
+
targets: {
|
|
54
|
+
'browsers': [
|
|
55
|
+
'defaults',
|
|
56
|
+
'not dead',
|
|
57
|
+
'Chrome 71', // compile public class fields and optional chaining
|
|
58
|
+
'last 1 Chrome versions',
|
|
59
|
+
'last 1 Firefox versions',
|
|
60
|
+
'last 1 Safari versions',
|
|
61
|
+
'last 1 Edge versions'
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
presets: ['@babel/preset-env', {
|
|
65
|
+
exclude: ['transform-regenerator'],
|
|
66
|
+
}],
|
|
67
|
+
plugins: [
|
|
68
|
+
['@babel/plugin-proposal-decorators', { 'legacy': true }],
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
test: /\.less$/,
|
|
75
|
+
use: [
|
|
76
|
+
'raw-loader',
|
|
77
|
+
'less-loader'
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
// test results reporter to use
|
|
84
|
+
// possible values: 'jasmine-diff', 'dots', 'progress', 'junit', 'growl', 'coverage'
|
|
85
|
+
reporters: ['jasmine-diff', 'progress', 'dots'],
|
|
86
|
+
junitReporter: {
|
|
87
|
+
outputFile: 'test/test-reports/karma-results.xml',
|
|
88
|
+
useBrowserName: false,
|
|
89
|
+
suite: ''
|
|
90
|
+
},
|
|
91
|
+
coverageReporter: {
|
|
92
|
+
reporters: [
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
jasmineDiffReporter: {
|
|
96
|
+
color: {
|
|
97
|
+
expectedBg: 'bgRed',
|
|
98
|
+
expectedWhitespaceBg: 'bgRed',
|
|
99
|
+
expectedFg: 'white',
|
|
100
|
+
actualBg: 'bgGreen',
|
|
101
|
+
actualWhitespaceBg: 'bgGreen',
|
|
102
|
+
actualFg: 'white',
|
|
103
|
+
warningBg: 'bgYellow',
|
|
104
|
+
warningWhitespaceBg: 'bgYellow',
|
|
105
|
+
warningFg: 'white',
|
|
106
|
+
defaultBg: '',
|
|
107
|
+
defaultFg: ''
|
|
108
|
+
},
|
|
109
|
+
pretty: true,
|
|
110
|
+
multiline: true,
|
|
111
|
+
verbose: true,
|
|
112
|
+
legacy: false,
|
|
113
|
+
matchers: {}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
plugins: [
|
|
117
|
+
'karma-jasmine',
|
|
118
|
+
'karma-webpack',
|
|
119
|
+
'karma-sourcemap-loader',
|
|
120
|
+
'karma-chrome-launcher',
|
|
121
|
+
'karma-nyan-reporter',
|
|
122
|
+
'karma-jasmine-diff-reporter'
|
|
123
|
+
],
|
|
124
|
+
frameworks: ['jasmine'],
|
|
125
|
+
|
|
126
|
+
// web server port
|
|
127
|
+
port: 9876,
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
// enable / disable colors in the output (reporters and logs)
|
|
131
|
+
colors: true,
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
// level of logging
|
|
135
|
+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
136
|
+
// logLevel: config.LOG_ERROR,
|
|
137
|
+
logLevel: config.LOG_DEBUG,
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
// enable / disable watching file and executing tests whenever any file changes
|
|
141
|
+
autoWatch: true,
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// Start these browsers, currently available:
|
|
145
|
+
// - Chrome
|
|
146
|
+
// - ChromeCanary
|
|
147
|
+
// - Firefox
|
|
148
|
+
// - Opera
|
|
149
|
+
// - Safari (only Mac)
|
|
150
|
+
// - PhantomJS
|
|
151
|
+
// - IE (only Windows)
|
|
152
|
+
//browsers: ['Chrome', 'Safari', 'Firefox', 'Opera', 'IE11 - Win7', 'IE10 - Win7', 'IE9 - Win7'],
|
|
153
|
+
// browsers: ['Chrome', 'Safari', 'Firefox', 'IE11 - Win7'],
|
|
154
|
+
browsers: ['Chrome'],
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
// If browser does not capture in given timeout [ms], kill it
|
|
158
|
+
captureTimeout: 60000,
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
// Continuous Integration mode
|
|
162
|
+
// if true, it capture browsers, run tests and exit
|
|
163
|
+
singleRun: false
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
if(saucelabs) {
|
|
167
|
+
karmaConfig.reporters.push('saucelabs');
|
|
168
|
+
karmaConfig.plugins.push('karma-sauce-launcher');
|
|
169
|
+
karmaConfig.captureTimeout = 120000;
|
|
170
|
+
karmaConfig.browserNoActivityTimeout = 60000; // Increase from 30000
|
|
171
|
+
karmaConfig.browserDisconnectTimeout = 10000; // Increase from 2000
|
|
172
|
+
karmaConfig.browserDisconnectTolerance = 3; // Increase from 0
|
|
173
|
+
karmaConfig.singleRun = true;
|
|
174
|
+
karmaConfig.sauceLabs = {
|
|
175
|
+
testName: 'Connect JS unit tests'
|
|
176
|
+
};
|
|
177
|
+
karmaConfig.customLaunchers = customLaunchers;
|
|
178
|
+
karmaConfig.browsers = Object.keys(customLaunchers);
|
|
179
|
+
karmaConfig.concurrency = 5;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if(coverage === 'true') {
|
|
183
|
+
// Add plugin to babel config
|
|
184
|
+
karmaConfig.webpack.module.rules[0].use.options.plugins.push(
|
|
185
|
+
[
|
|
186
|
+
'istanbul',
|
|
187
|
+
{
|
|
188
|
+
'include': 'src/host/**/*.js'
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
);
|
|
192
|
+
karmaConfig.reporters.push('coverage');
|
|
193
|
+
karmaConfig.plugins.push('karma-coverage');
|
|
194
|
+
karmaConfig.coverageReporter.reporters.push({type: 'html', dir: 'coverage/', subdir: '.'});
|
|
195
|
+
karmaConfig.coverageReporter.reporters.push({type: 'json', dir: 'coverage/', subdir: '.'});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return karmaConfig;
|
|
199
|
+
};
|
|
200
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var envify = require('envify/custom');
|
|
2
|
+
var webpack = require('webpack');
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var fs = require('graceful-fs');
|
|
5
|
+
var cwd = process.cwd();
|
|
6
|
+
var getDirs = (srcpath) => fs.readdirSync(srcpath).filter((file) => fs.statSync(path.join(srcpath, file)).isDirectory());
|
|
7
|
+
var base = cwd + '/src/host';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
module.exports = function(config) {
|
|
11
|
+
var baseConfig = require('./karma.base.conf.js')(config);
|
|
12
|
+
|
|
13
|
+
baseConfig.files.push('spec/tests/**/*.js');
|
|
14
|
+
|
|
15
|
+
baseConfig.webpack.plugins.push(new webpack.DefinePlugin({'process.env.ENV': '"host"'}));
|
|
16
|
+
|
|
17
|
+
getDirs(base).forEach((root) => baseConfig.webpack.resolve.alias[root] = `${base}/${root}`);
|
|
18
|
+
|
|
19
|
+
config.set(baseConfig);
|
|
20
|
+
};
|