├── .chglog ├── CHANGELOG.tpl.md ├── RELEASE.tpl.md ├── config.yml └── release-config.yml ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ ├── github-ci.yml │ └── reuse-compliance.yml ├── .gitignore ├── .npmrc ├── .reuse └── dep5 ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Gruntfile.js ├── LICENSE.txt ├── LICENSES └── Apache-2.0.txt ├── README.md ├── SECURITY.md ├── package-lock.json ├── package.json ├── tasks ├── connect.js ├── preload.js └── theme.js └── test ├── asserts └── fileContent.js ├── connect └── fixtures │ ├── anotherLib │ ├── res │ │ └── controlOfAnotherLib.js │ └── testres │ │ └── someTest.js │ ├── app │ └── app.html │ ├── foo.html │ └── someLib │ ├── resources │ └── someHtml.html │ └── test-resources │ └── SomeTest.html ├── connect_test.js ├── preload ├── expected │ ├── component_compat_140 │ │ └── my │ │ │ └── app │ │ │ └── Component-preload.js │ ├── component_compat_154 │ │ └── my │ │ │ └── app │ │ │ └── Component-preload.js │ ├── component_default_options │ │ └── my │ │ │ └── app │ │ │ └── Component-preload.js │ ├── component_no_compress │ │ └── my │ │ │ └── app │ │ │ └── Component-preload.js │ ├── component_resource_prefix │ │ └── Component-preload.js │ ├── library_compat_138 │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.json │ ├── library_compat_140 │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.js │ ├── library_compat_154 │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.js │ ├── library_custom_terser_params │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.js │ ├── library_custom_uglify_params │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.js │ ├── library_default_options │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.js │ ├── library_no_compress │ │ └── my │ │ │ └── ui │ │ │ └── lib │ │ │ └── library-preload.js │ └── library_resource_prefix │ │ └── library-preload.js └── fixtures │ ├── app-same-dest │ └── my │ │ └── app │ │ ├── Component-preload.js │ │ ├── Component.js │ │ └── view │ │ ├── my.view.xml │ │ └── myHtmlPre.view.xml │ ├── app │ └── my │ │ └── app │ │ ├── Component.js │ │ └── view │ │ ├── my.view.xml │ │ └── myHtmlPre.view.xml │ ├── library-custom-terser-params │ └── my │ │ └── ui │ │ └── lib │ │ ├── foo.properties │ │ ├── library.js │ │ ├── my.view.xml │ │ ├── myHtmlPre.view.xml │ │ ├── myJS.js │ │ └── myJSON.json │ ├── library-custom-uglify-params │ └── my │ │ └── ui │ │ └── lib │ │ ├── foo.properties │ │ ├── library.js │ │ ├── my.view.xml │ │ ├── myHtmlPre.view.xml │ │ ├── myJS.js │ │ └── myJSON.json │ ├── library-same-dest │ └── my │ │ └── ui │ │ └── lib │ │ ├── foo.properties │ │ ├── library-preload.js │ │ ├── library.js │ │ ├── my.view.xml │ │ ├── myHtmlPre.view.xml │ │ ├── myJS.js │ │ └── myJSON.json │ └── library │ └── my │ └── ui │ └── lib │ ├── foo.properties │ ├── library.js │ ├── my.view.xml │ ├── myHtmlPre.view.xml │ ├── myJS.js │ └── myJSON.json ├── preload_test.js ├── theme ├── expected │ ├── compress_option │ │ ├── library-RTL.css │ │ ├── library-parameters.json │ │ └── library.css │ ├── default_options │ │ ├── library-RTL.css │ │ ├── library-parameters.json │ │ └── library.css │ └── rootPaths_option │ │ ├── library-RTL.css │ │ ├── library-parameters.json │ │ └── library.css └── fixtures │ ├── lib1 │ └── my │ │ └── theme │ │ └── foo │ │ └── foo.less │ └── lib2 │ └── my │ └── theme │ └── bar │ └── bar.less └── theme_test.js /.chglog/CHANGELOG.tpl.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 4 | 5 | {{ if .Versions -}} 6 | A list of unreleased changes can be found [here]({{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD). 7 | {{ end -}} 8 | 9 | {{ range .Versions }} 10 | 11 | ## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }} 12 | {{ range .CommitGroups -}} 13 | ### {{ .Title }} 14 | {{ range .Commits -}} 15 | - {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} [`{{ .Hash.Short }}`]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}) 16 | {{ end }} 17 | {{ end -}} 18 | 19 | {{- if .RevertCommits -}} 20 | ### Reverts 21 | {{ range .RevertCommits -}} 22 | - {{ .Revert.Header }} 23 | {{ end }} 24 | {{ end -}} 25 | 26 | {{- if .NoteGroups -}} 27 | {{ range .NoteGroups -}} 28 | ### {{ .Title }} 29 | {{ range .Notes }} 30 | {{ .Body }} 31 | {{ end }} 32 | {{ end -}} 33 | {{ end -}} 34 | {{ end -}} 35 | 36 | {{- if .Versions }} 37 | {{ range .Versions -}} 38 | {{ if .Tag.Previous -}} 39 | [{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} 40 | {{ end -}} 41 | {{ end -}} 42 | {{ end -}} 43 | 44 | # 0.15.0 - 2018-10-16 45 | 46 | ### Other changes 47 | - Update dependencies [#80](https://github.com/SAP/grunt-openui5/pull/80) 48 | - [connect-openui5@^0.7.5](https://github.com/SAP/connect-openui5/releases/tag/0.7.5) 49 | - [less-openui5@^0.6.0](https://github.com/SAP/less-openui5/releases/tag/0.6.0) 50 | 51 | ### All changes 52 | [`0.14.0...0.15.0`](https://github.com/SAP/grunt-openui5/compare/0.14.0...0.15.0) 53 | 54 | 55 | # 0.14.0 - 2018-05-18 56 | 57 | ### Features 58 | - openui5_preload task 59 | - preload: ES6+ support for uglifying JS Files [#70](https://github.com/SAP/grunt-openui5/pull/70) 60 | 61 | ### Breaking changes 62 | - openui5_preload task 63 | - `compress.uglifyjs` option is now based on [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony). 64 | 65 | ### All changes 66 | [`0.13.0...0.14.0`](https://github.com/SAP/grunt-openui5/compare/0.13.0...0.14.0) 67 | 68 | 69 | # 0.13.0 - 2018-03-13 70 | 71 | ### Features 72 | - openui5_preload task 73 | - Usage of sap.ui.require.preload for library-preload.js >=1.54 [#55](https://github.com/SAP/grunt-openui5/pull/65) 74 | ### Other changes 75 | - Update dependencies ([`a04861e`](https://github.com/SAP/grunt-openui5/commit/a04861e151743da711364147c566b62cd49f082e)) 76 | 77 | ### Breaking changes 78 | - Drop unsupported Node.js versions v0.12 / v5 / v7 ([`1d5735f`](https://github.com/SAP/grunt-openui5/commit/1d5735fd8f81e24ef17f50ff7d94834376e9f429)) 79 | ### All changes 80 | [`0.12.0...0.13.0`](https://github.com/SAP/grunt-openui5/compare/0.12.0...0.13.0) 81 | 82 | 83 | # 0.12.0 - 2017-03-24 84 | 85 | ### Features 86 | - openui5_theme task 87 | - Support theme scopes (Belize Themes) [#55](https://github.com/SAP/grunt-openui5/pull/55) (via [SAP/less-openui5#10](https://github.com/SAP/less-openui5/pull/10)) 88 | - openui5_connect task 89 | - Support theme scopes (Belize Themes) [#57](https://github.com/SAP/grunt-openui5/pull/57) (via [SAP/less-openui5#10](https://github.com/SAP/less-openui5/pull/10)) 90 | 91 | ### All changes 92 | [`0.11.0...0.12.0`](https://github.com/SAP/grunt-openui5/compare/0.11.0...0.12.0) 93 | 94 | 95 | # 0.11.0 - 2016-12-01 96 | 97 | ### Breaking changes 98 | - Drop Node.js v0.10 support [`e99df21`](https://github.com/SAP/grunt-openui5/commit/e99df2129ec40960af70589a893af6732ba05295) 99 | - openui5_preload task 100 | - Create library-preload.js files instead of .json [#47](https://github.com/SAP/grunt-openui5/pull/47) [`cb9bcae`](https://github.com/SAP/grunt-openui5/commit/cb9bcaef6cf8c8cef39f109f1cbb9bae21356e0a) 101 | 102 | ### Features 103 | - openui5_preload task 104 | - Introduce [`compatVersion` option](https://github.com/SAP/grunt-openui5#compatversion) [#47](https://github.com/SAP/grunt-openui5/pull/47) [`cb9bcae`](https://github.com/SAP/grunt-openui5/commit/cb9bcaef6cf8c8cef39f109f1cbb9bae21356e0a) 105 | 106 | ### Others 107 | - Update npm dependencies / replace "url-join" with "urljoin" [#49](https://github.com/SAP/grunt-openui5/pull/49) [`b820a68`](https://github.com/SAP/grunt-openui5/commit/b820a6830cb7505374a10e86816263860f9a52c5) 108 | - Travis CI: Add node v7 / drop v0.10 [`f691e1a`](https://github.com/SAP/grunt-openui5/commit/f691e1a314d9b4d1ff6e540012562639e749276f) 109 | 110 | ### All changes 111 | [`0.10.0...0.11.0`](https://github.com/SAP/grunt-openui5/compare/0.10.0...0.11.0) 112 | 113 | # 0.10.0 - 2016-09-09 114 | 115 | ### Features 116 | - openui5_preload task 117 | - Compression options for UglifyJS [#41](https://github.com/SAP/grunt-openui5/pull/41) [`b2e6c0e`](https://github.com/SAP/grunt-openui5/commit/b2e6c0e87f94d1fc46b8fafa69bd40e8d2ffe88f) 118 | 119 | ### Fixes 120 | - openui5_preload task 121 | - Fail gracefully when minification fails [#42](https://github.com/SAP/grunt-openui5/pull/42) [`52b6c78`](https://github.com/SAP/grunt-openui5/commit/52b6c78d21eec1d90987838d3e7726d19baa8fca) 122 | 123 | ### Others 124 | - Documentation: openui5_theme default example [#33](https://github.com/SAP/grunt-openui5/pull/33) [`8ef82a5`](https://github.com/SAP/grunt-openui5/commit/8ef82a510aed7159c81433d1896fbe7073535426) 125 | 126 | ### All changes 127 | [`0.9.0...0.10.0`](https://github.com/SAP/grunt-openui5/compare/0.9.0...0.10.0) 128 | 129 | 130 | # 0.9.0 - 2016-04-25 131 | 132 | ### Breaking changes 133 | - openui5_connect / openui5_theme tasks 134 | - Set default of parser option `relativeUrls` to `true` [`4d5fca2 ` via less-openui5@0.2.0](https://github.com/SAP/connect-openui5/commit/4d5fca25954049eec4af53c8bd12c54d6ad020aa) (see [`7cc2781 `](https://github.com/SAP/grunt-openui5/commit/7cc2781bfb63c95deef2a63a426d791f02a8770b)) 135 | 136 | ### Features 137 | - openui5_connect task 138 | - support `lessOptions` [`a8c1280`](https://github.com/SAP/grunt-openui5/commit/a8c1280f09a0dc20fd4987600572a8f34e5d9dc4) 139 | 140 | ### Fixes 141 | - openui5_preload task 142 | - Always exclude corresponding preload files [`a9ebf40`](https://github.com/SAP/grunt-openui5/commit/a9ebf407bd4700136b0d7277cdac53d2c6366bb7) 143 | 144 | ### Others 145 | - Support Grunt 1.0 [`046e8ca`](https://github.com/SAP/grunt-openui5/commit/046e8ca5c2ab0954c679712a2b3259c8e2a918dc) 146 | - Update dependencies [`7cc2781`](https://github.com/SAP/grunt-openui5/commit/7cc2781bfb63c95deef2a63a426d791f02a8770b) 147 | 148 | ### All changes 149 | [`0.8.1...0.9.0`](https://github.com/SAP/grunt-openui5/compare/0.8.1...0.9.0) 150 | 151 | 152 | # 0.8.1 - 2016-01-20 153 | 154 | ### Others 155 | - Update dependencies [`4524b2f`](https://github.com/SAP/grunt-openui5/commit/4524b2ffd4b58b5bde777ed4268f013db30ef610) [`70e2c92`](https://github.com/SAP/grunt-openui5/commit/70e2c9286ec26a5a02f7204747abc89f6cf8020a) 156 | 157 | ### All changes 158 | [`0.8.0...0.8.1`](https://github.com/SAP/grunt-openui5/compare/0.8.0...0.8.1) 159 | 160 | 161 | # 0.8.0 - 2015-08-17 162 | 163 | ### Fixes 164 | - openui5_connect task 165 | - support [connect](https://github.com/gruntjs/grunt-contrib-connect) v3 [`b3c9da9`](https://github.com/SAP/grunt-openui5/commit/b3c9da93cd9984ba6bbc391bbdc7745379fa0019) 166 | 167 | ### Others 168 | - bump dependencies [`b3c9da9`](https://github.com/SAP/grunt-openui5/commit/b3c9da93cd9984ba6bbc391bbdc7745379fa0019) 169 | 170 | ### All changes 171 | [`0.7.0...0.8.0`](https://github.com/SAP/grunt-openui5/compare/0.7.0...0.8.0) 172 | 173 | 174 | # 0.7.0 - 2015-03-16 175 | 176 | ### Features 177 | - openui5_connect task 178 | - allow custom middleware (via [connect](https://github.com/gruntjs/grunt-contrib-connect) task [`middleware` function](https://github.com/gruntjs/grunt-contrib-connect#middleware)) [`1cab971`](https://github.com/SAP/grunt-openui5/commit/1cab9712343fe5e0c70fc98ba14e8425718d466e) 179 | - openui5_preload task 180 | - improved error logging / log file compression [`aa16e59`](https://github.com/SAP/grunt-openui5/commit/aa16e59dbb4df9676f89ae8a95234aa289cd9c3d) 181 | 182 | ### Others 183 | - openui5_connect task 184 | - change deprecated usage of server-static "hidden" [`d3911ab`](https://github.com/SAP/grunt-openui5/commit/d3911ab3ce0b3eca8f68a06b0593131b4eb1a7b9) 185 | - bump dependencies [`f949f90`](https://github.com/SAP/grunt-openui5/commit/f949f90eb81190fb39b5102a40ba7c3c60e97621) 186 | 187 | ### All changes 188 | [`0.6.0...0.7.0`](https://github.com/SAP/grunt-openui5/compare/0.6.0...0.7.0) 189 | 190 | 191 | # 0.6.0 - 2015-01-12 192 | 193 | ### Features 194 | - openui5_connect task 195 | - add proxyOptions [`f823c65`](https://github.com/SAP/grunt-openui5/commit/f823c655e72ce940a2b6abc4ee03aaa247a55bed) 196 | 197 | ### Fixes 198 | - openui5_preload task 199 | - error message when no module file could be found [`f6f18ae`](https://github.com/SAP/grunt-openui5/commit/f6f18ae9043846e367ab98f01494b00844e346ca) 200 | 201 | ### All changes 202 | [`0.5.0...0.6.0`](https://github.com/SAP/grunt-openui5/compare/0.5.0...0.6.0) 203 | 204 | 205 | # 0.5.0 - 2014-12-08 206 | 207 | ### Breaking changes 208 | - openui5_library_preload task 209 | - removed, use openui5_preload task instead [`9e8e556`](https://github.com/SAP/grunt-openui5/commit/9e8e55666a548262532b2a84799d68745e796935) 210 | 211 | ### Features 212 | - openui5_preload task 213 | - new task to create preload files for components / libraries [`816507d`](https://github.com/SAP/grunt-openui5/commit/816507d045a11bf9dbb0370d69151ad5f341b6ae) 214 | 215 | ### All changes 216 | [`0.4.0...0.5.0`](https://github.com/SAP/grunt-openui5/compare/0.4.0...0.5.0) 217 | 218 | 219 | # 0.4.0 - 2014-11-21 220 | 221 | ### Breaking changes 222 | - openui5_connect task 223 | - task does only contain `openui5_connect` specific options. All other `connect` options have to be configured in the [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect) task [`91c6261`](https://github.com/SAP/grunt-openui5/commit/91c62612cd4c4c4357602daa4ae35e6ab04abc4f) 224 | 225 | ### Features 226 | - openui5_connect task 227 | - added `proxypath` option to enable a generic proxy [`91c6261`](https://github.com/SAP/grunt-openui5/commit/91c62612cd4c4c4357602daa4ae35e6ab04abc4f) [`1b78fb2`](https://github.com/SAP/grunt-openui5/commit/1b78fb2656549cd64511f638441bcf53df608a87) 228 | - `livereload` option (from [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect#livereload) task) will include an additional LiveReload plugin to enable live-reloading of CSS with source LESS files [`20225e8`](https://github.com/SAP/grunt-openui5/commit/20225e8d6b381e882cd8c885db84b3b7b0eae9af) 229 | 230 | ### All changes 231 | [`0.3.0...0.4.0`](https://github.com/SAP/grunt-openui5/compare/0.3.0...0.4.0) 232 | 233 | 234 | # 0.3.0 - 2014-11-12 235 | 236 | ### Features 237 | - openui5_connect task 238 | - added JS, XML & JSON compression [`011d4af`](https://github.com/SAP/grunt-openui5/commit/011d4afa913d29e9b17702935a7cbdd0bc871a49) [`3905400`](https://github.com/SAP/grunt-openui5/commit/39054000c1bdc12dd445df4c0f1185bfa288f5d1) (thanks to [@olirogers](https://github.com/olirogers)) 239 | 240 | ### All changes 241 | [`0.2.1...0.3.0`](https://github.com/SAP/grunt-openui5/compare/0.2.1...0.3.0) 242 | -------------------------------------------------------------------------------- /.chglog/RELEASE.tpl.md: -------------------------------------------------------------------------------- 1 | {{ range .Versions }} 2 | {{ range .CommitGroups -}} 3 | ### {{ .Title }} 4 | {{ range .Commits -}} 5 | - {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} [`{{ .Hash.Short }}`]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}) 6 | {{ end }} 7 | {{ end -}} 8 | 9 | {{- if .RevertCommits -}} 10 | ### Reverts 11 | {{ range .RevertCommits -}} 12 | - {{ .Revert.Header }} 13 | {{ end }} 14 | {{ end -}} 15 | 16 | {{- if .NoteGroups -}} 17 | {{ range .NoteGroups -}} 18 | ### {{ .Title }} 19 | {{ range .Notes }} 20 | {{ .Body }} 21 | {{ end }} 22 | {{ end -}} 23 | {{ end -}} 24 | 25 | {{ if .Tag.Previous }} 26 | ### All changes 27 | [`{{ .Tag.Previous.Name }}...{{ .Tag.Name }}`] 28 | {{ end }} 29 | 30 | {{ if .Tag.Previous -}} 31 | [`{{ .Tag.Previous.Name }}...{{ .Tag.Name }}`]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} 32 | {{ end -}} 33 | {{ end -}} 34 | -------------------------------------------------------------------------------- /.chglog/config.yml: -------------------------------------------------------------------------------- 1 | style: github 2 | template: CHANGELOG.tpl.md 3 | info: 4 | title: CHANGELOG 5 | repository_url: https://github.com/SAP/grunt-openui5 6 | options: 7 | commits: 8 | filters: 9 | Type: 10 | - FEATURE 11 | - FIX 12 | - PERF 13 | - DEPENDENCY 14 | - BREAKING 15 | commit_groups: 16 | title_maps: 17 | FEATURE: Features 18 | FIX: Bug Fixes 19 | PERF: Performance Improvements 20 | DEPENDENCY: Dependency Updates 21 | BREAKING: Breaking Changes 22 | header: 23 | pattern: "^\\[(\\w*)\\]\\s(?:([^\\:]*)\\:\\s)?(.*)$" 24 | pattern_maps: 25 | - Type 26 | - Scope 27 | - Subject 28 | issues: 29 | prefix: 30 | - "#" 31 | notes: 32 | keywords: 33 | - BREAKING CHANGE 34 | -------------------------------------------------------------------------------- /.chglog/release-config.yml: -------------------------------------------------------------------------------- 1 | style: github 2 | template: RELEASE.tpl.md 3 | info: 4 | repository_url: https://github.com/SAP/grunt-openui5 5 | options: 6 | commits: 7 | filters: 8 | Type: 9 | - FEATURE 10 | - FIX 11 | - PERF 12 | - DEPENDENCY 13 | - BREAKING 14 | commit_groups: 15 | title_maps: 16 | FEATURE: Features 17 | FIX: Bug Fixes 18 | PERF: Performance Improvements 19 | DEPENDENCY: Dependency Updates 20 | BREAKING: Breaking Changes 21 | header: 22 | pattern: "^\\[(\\w*)\\]\\s(?:([^\\:]*)\\:\\s)?(.*)$" 23 | pattern_maps: 24 | - Type 25 | - Scope 26 | - Subject 27 | issues: 28 | prefix: 29 | - "#" 30 | notes: 31 | keywords: 32 | - BREAKING CHANGE 33 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # see http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = tab 8 | 9 | [*.{css,html,js,less,txt,json,yml,md}] 10 | trim_trailing_whitespace = true 11 | end_of_line = lf 12 | indent_size = 4 13 | insert_final_newline = true 14 | 15 | [*.{yml,yaml}] 16 | indent_style = space 17 | indent_size = 2 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | tmp 2 | test/**/fixtures 3 | test/**/expected 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "node": true, 4 | "es6": true 5 | }, 6 | "parserOptions": { 7 | "ecmaVersion": 8 8 | }, 9 | "extends": ["eslint:recommended", "google"], 10 | "rules": { 11 | "indent": [ 12 | "error", 13 | "tab" 14 | ], 15 | "linebreak-style": [ 16 | "error", 17 | "unix" 18 | ], 19 | "quotes": [ 20 | "error", 21 | "double", 22 | {"allowTemplateLiterals": true} 23 | ], 24 | "semi": [ 25 | "error", 26 | "always" 27 | ], 28 | "no-negated-condition": "off", 29 | "require-jsdoc": "off", 30 | "no-mixed-requires": "off", 31 | "max-len": [ 32 | "error", 33 | { 34 | "code": 120, 35 | "ignoreUrls": true, 36 | "ignoreRegExpLiterals": true 37 | } 38 | ], 39 | "no-implicit-coercion": [ 40 | 2, 41 | {"allow": ["!!"]} 42 | ], 43 | "comma-dangle": "off", 44 | "no-tabs": "off", 45 | 46 | 47 | // Grunt tasks are making use of "this" 48 | "no-invalid-this": "off" 49 | }, 50 | "root": true 51 | }; 52 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | - package-ecosystem: npm 8 | directory: "/" 9 | schedule: 10 | interval: weekly 11 | day: sunday 12 | time: "10:00" 13 | timezone: Etc/UCT 14 | reviewers: 15 | - matz3 16 | - RandomByte 17 | versioning-strategy: increase 18 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | # Execute at least once per week to get new findings without active development taking place 10 | schedule: 11 | - cron: '42 14 * * 6' 12 | 13 | jobs: 14 | codeql-analyze: 15 | name: "CodeQL Analyze" 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout repository 20 | uses: actions/checkout@v3 21 | 22 | # Initializes the CodeQL tools for scanning. 23 | - name: Initialize CodeQL 24 | uses: github/codeql-action/init@v2 25 | with: 26 | languages: 'javascript' 27 | # If you wish to specify custom queries, you can do so here or in a config file. 28 | # By default, queries listed here will override any specified in a config file. 29 | # Prefix the list here with "+" to use these queries and those in the config file. 30 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 31 | 32 | # ℹ️ Command-line programs to run using the OS shell. 33 | # 📚 https://git.io/JvXDl 34 | 35 | - name: Perform CodeQL Analysis 36 | uses: github/codeql-action/analyze@v2 37 | -------------------------------------------------------------------------------- /.github/workflows/github-ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | test: 11 | name: General checks, tests and coverage reporting 12 | runs-on: ubuntu-latest 13 | steps: 14 | 15 | - uses: actions/checkout@v3 16 | 17 | - name: Use Node.js LTS 14.x 18 | uses: actions/setup-node@v3.6.0 19 | with: 20 | node-version: 14.x 21 | 22 | - name: Install dependencies 23 | run: npm ci 24 | 25 | - name: Perform checks and tests 26 | run: npm test 27 | 28 | - name: Send report to Coveralls 29 | uses: coverallsapp/github-action@v2.1.2 30 | with: 31 | github-token: ${{ secrets.GITHUB_TOKEN }} 32 | 33 | test-matrix: 34 | name: Unit tests on Node.js ${{ matrix.node-version }} and ${{ matrix.os }} 35 | strategy: 36 | fail-fast: false 37 | matrix: 38 | node-version: [16] 39 | os: [ubuntu-latest, windows-latest, macOS-latest] 40 | include: 41 | - node-version: 10 42 | os: ubuntu-latest 43 | - node-version: 12 44 | os: ubuntu-latest 45 | - node-version: 14 46 | os: ubuntu-latest 47 | runs-on: ${{ matrix.os }} 48 | steps: 49 | 50 | - uses: actions/checkout@v3 51 | 52 | - name: Use Node.js ${{ matrix.node-version }} 53 | uses: actions/setup-node@v3.6.0 54 | with: 55 | node-version: ${{ matrix.node-version }} 56 | 57 | - run: npm ci 58 | name: Install dependencies 59 | 60 | - run: npm ls --prod 61 | name: Check for missing / extraneous Dependencies 62 | 63 | - run: npm run unit 64 | name: Run unit tests 65 | -------------------------------------------------------------------------------- /.github/workflows/reuse-compliance.yml: -------------------------------------------------------------------------------- 1 | name: REUSE 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | compliance-check: 11 | name: Compliance Check 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - name: Execute REUSE Compliance Check 16 | uses: fsfe/reuse-action@v1.1 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # CI (Azure Pipelines) xUnit test results 21 | test-results.xml 22 | 23 | # IDEs 24 | .vscode/ 25 | *.~vsdx 26 | .idea/ 27 | 28 | # node-waf configuration 29 | .lock-wscript 30 | 31 | # Compiled binary addons (http://nodejs.org/api/addons.html) 32 | build/Release 33 | 34 | # Dependency directories 35 | node_modules 36 | jspm_packages 37 | 38 | # Optional npm cache directory 39 | .npm 40 | 41 | # Optional eslint cache 42 | .eslintcache 43 | 44 | # Optional REPL history 45 | .node_repl_history 46 | 47 | # Output of 'npm pack' 48 | *.tgz 49 | 50 | # Yarn Integrity file 51 | .yarn-integrity 52 | 53 | # Misc 54 | yarn.lock 55 | .DS_Store 56 | 57 | # Don't include private SSH key for deployment via Travis CI 58 | deploy_key 59 | 60 | # Custom directories 61 | tmp 62 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # Enforce public npm registry 2 | registry = https://registry.npmjs.org/ 3 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: grunt-openui5 3 | Upstream-Contact: SAP OpenUI5 4 | Source: https://github.com/SAP/grunt-openui5 5 | Disclaimer: The code in this project may include calls to APIs (“API Calls”) of 6 | SAP or third-party products or services developed outside of this project 7 | (“External Products”). 8 | “APIs” means application programming interfaces, as well as their respective 9 | specifications and implementing code that allows software to communicate with 10 | other software. 11 | API Calls to External Products are not licensed under the open source license 12 | that governs this project. The use of such API Calls and related External 13 | Products are subject to applicable additional agreements with the relevant 14 | provider of the External Products. In no event shall the open source license 15 | that governs this project grant any rights in or to any External Products,or 16 | alter, expand or supersede any terms of the applicable additional agreements. 17 | If you have a valid license agreement with SAP for the use of a particular SAP 18 | External Product, then you may make use of any API Calls included in this 19 | project’s code for that SAP External Product, subject to the terms of such 20 | license agreement. If you do not have a valid license agreement for the use of 21 | a particular SAP External Product, then you may only make use of any API Calls 22 | in this project for that SAP External Product for your internal, non-productive 23 | and non-commercial test and evaluation of such API Calls. Nothing herein grants 24 | you any rights to use or access any SAP External Product, or provide any third 25 | parties the right to use of access any SAP External Product, through API Calls. 26 | 27 | Files: * 28 | Copyright: 2014-2021 SAP SE or an SAP affiliate company and grunt-openui5 contributors 29 | License: Apache-2.0 30 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 4 | 5 | A list of unreleased changes can be found [here](https://github.com/SAP/grunt-openui5/compare/v0.18.4...HEAD). 6 | 7 | 8 | ## [v0.18.4] - 2022-12-01 9 | ### Dependency Updates 10 | - Bump connect-openui5 from 0.10.2 to 0.10.3 [`67f954a`](https://github.com/SAP/grunt-openui5/commit/67f954ac6fcdb4fc9fb69cc17c9ddd589dc747c9) 11 | - Bump less-openui5 from 0.11.2 to 0.11.3 [`02b5a52`](https://github.com/SAP/grunt-openui5/commit/02b5a52ea1ba33f2ea15ff466e8e171f1698909d) 12 | 13 | 14 | 15 | ## [v0.18.3] - 2022-05-19 16 | ### Bug Fixes 17 | - Remove deprecated multiline dependency ([#235](https://github.com/SAP/grunt-openui5/issues/235)) [`6d43601`](https://github.com/SAP/grunt-openui5/commit/6d43601cd7098eaa6b58b0427b5f0542901676a0) 18 | 19 | 20 | 21 | ## [v0.18.2] - 2021-03-15 22 | ### Dependency Updates 23 | - Bump less-openui5 from 0.10.0 to 0.11.0 ([#181](https://github.com/SAP/grunt-openui5/issues/181)) [`81f73b8`](https://github.com/SAP/grunt-openui5/commit/81f73b84bcfae306f694a5c0289db36783ace424) 24 | 25 | 26 | 27 | ## [v0.18.1] - 2021-02-01 28 | ### Dependency Updates 29 | - Bump connect-openui5 from 0.9.1 to 0.10.1 ([#177](https://github.com/SAP/grunt-openui5/issues/177)) [`6fa2518`](https://github.com/SAP/grunt-openui5/commit/6fa2518d54eeafa454afa7f6f1f0551bc2192bc8) 30 | - Bump less-openui5 from 0.8.7 to 0.10.0 ([#176](https://github.com/SAP/grunt-openui5/issues/176)) [`5b61aca`](https://github.com/SAP/grunt-openui5/commit/5b61aca7673ee01c13870c1a8033b1bf6c1fffdd) 31 | 32 | 33 | 34 | ## [v0.18.0] - 2020-10-21 35 | ### Dependency Updates 36 | - Bump terser from 4.8.0 to 5.3.0 ([#167](https://github.com/SAP/grunt-openui5/issues/167)) [`1799a5a`](https://github.com/SAP/grunt-openui5/commit/1799a5a2e61371d9c1f25a8f942d7e9ab70c446a) 37 | 38 | 39 | 40 | ## [v0.17.0] - 2020-09-10 41 | ### Breaking Changes 42 | - Require Node.js >= 10 [`8cadebc`](https://github.com/SAP/grunt-openui5/commit/8cadebce61b08e0a84e6def373387d12dac7805b) 43 | 44 | ### Dependency Updates 45 | - Bump connect-openui5 from 0.9.0 to 0.9.1 ([#168](https://github.com/SAP/grunt-openui5/issues/168)) [`72b936c`](https://github.com/SAP/grunt-openui5/commit/72b936c33b62642c89731ab6f31c3d2bff6299c1) 46 | 47 | ### Features 48 | - Switch to Terser for JavaScript minification ([#153](https://github.com/SAP/grunt-openui5/issues/153)) [`8c525ba`](https://github.com/SAP/grunt-openui5/commit/8c525ba764b49d3094f5bc048e7363614aed9ebd) 49 | 50 | ### BREAKING CHANGE 51 | 52 | Support for older Node.js releases has been dropped. 53 | Only Node.js v10 or higher is supported. 54 | 55 | 56 | 57 | ## [v0.16.0] - 2019-12-05 58 | ### Breaking Changes 59 | - Drop support for Node.js < 8.5 [`42b6391`](https://github.com/SAP/grunt-openui5/commit/42b6391662441c225e6c32347a930c855e6fcded) 60 | 61 | ### Bug Fixes 62 | - Upgrade less-openui5 dependency [`b553666`](https://github.com/SAP/grunt-openui5/commit/b553666bd8dcf3608344f49f79524dec47b27361) 63 | 64 | ### BREAKING CHANGE 65 | 66 | The openui5_theme compiler options `sourceMap` and `cleancss` are not 67 | supported anymore. An exception will be thrown when used. 68 | 69 | 70 | [v0.18.4]: https://github.com/SAP/grunt-openui5/compare/v0.18.3...v0.18.4 71 | [v0.18.3]: https://github.com/SAP/grunt-openui5/compare/v0.18.2...v0.18.3 72 | [v0.18.2]: https://github.com/SAP/grunt-openui5/compare/v0.18.1...v0.18.2 73 | [v0.18.1]: https://github.com/SAP/grunt-openui5/compare/v0.18.0...v0.18.1 74 | [v0.18.0]: https://github.com/SAP/grunt-openui5/compare/v0.17.0...v0.18.0 75 | [v0.17.0]: https://github.com/SAP/grunt-openui5/compare/v0.16.0...v0.17.0 76 | [v0.16.0]: https://github.com/SAP/grunt-openui5/compare/0.15.0...v0.16.0 77 | # 0.15.0 - 2018-10-16 78 | 79 | ### Other changes 80 | - Update dependencies [#80](https://github.com/SAP/grunt-openui5/pull/80) 81 | - [connect-openui5@^0.7.5](https://github.com/SAP/connect-openui5/releases/tag/0.7.5) 82 | - [less-openui5@^0.6.0](https://github.com/SAP/less-openui5/releases/tag/0.6.0) 83 | 84 | ### All changes 85 | [`0.14.0...0.15.0`](https://github.com/SAP/grunt-openui5/compare/0.14.0...0.15.0) 86 | 87 | 88 | # 0.14.0 - 2018-05-18 89 | 90 | ### Features 91 | - openui5_preload task 92 | - preload: ES6+ support for uglifying JS Files [#70](https://github.com/SAP/grunt-openui5/pull/70) 93 | 94 | ### Breaking changes 95 | - openui5_preload task 96 | - `compress.uglifyjs` option is now based on [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony). 97 | 98 | ### All changes 99 | [`0.13.0...0.14.0`](https://github.com/SAP/grunt-openui5/compare/0.13.0...0.14.0) 100 | 101 | 102 | # 0.13.0 - 2018-03-13 103 | 104 | ### Features 105 | - openui5_preload task 106 | - Usage of sap.ui.require.preload for library-preload.js >=1.54 [#55](https://github.com/SAP/grunt-openui5/pull/65) 107 | ### Other changes 108 | - Update dependencies ([`a04861e`](https://github.com/SAP/grunt-openui5/commit/a04861e151743da711364147c566b62cd49f082e)) 109 | 110 | ### Breaking changes 111 | - Drop unsupported Node.js versions v0.12 / v5 / v7 ([`1d5735f`](https://github.com/SAP/grunt-openui5/commit/1d5735fd8f81e24ef17f50ff7d94834376e9f429)) 112 | ### All changes 113 | [`0.12.0...0.13.0`](https://github.com/SAP/grunt-openui5/compare/0.12.0...0.13.0) 114 | 115 | 116 | # 0.12.0 - 2017-03-24 117 | 118 | ### Features 119 | - openui5_theme task 120 | - Support theme scopes (Belize Themes) [#55](https://github.com/SAP/grunt-openui5/pull/55) (via [SAP/less-openui5#10](https://github.com/SAP/less-openui5/pull/10)) 121 | - openui5_connect task 122 | - Support theme scopes (Belize Themes) [#57](https://github.com/SAP/grunt-openui5/pull/57) (via [SAP/less-openui5#10](https://github.com/SAP/less-openui5/pull/10)) 123 | 124 | ### All changes 125 | [`0.11.0...0.12.0`](https://github.com/SAP/grunt-openui5/compare/0.11.0...0.12.0) 126 | 127 | 128 | # 0.11.0 - 2016-12-01 129 | 130 | ### Breaking changes 131 | - Drop Node.js v0.10 support [`e99df21`](https://github.com/SAP/grunt-openui5/commit/e99df2129ec40960af70589a893af6732ba05295) 132 | - openui5_preload task 133 | - Create library-preload.js files instead of .json [#47](https://github.com/SAP/grunt-openui5/pull/47) [`cb9bcae`](https://github.com/SAP/grunt-openui5/commit/cb9bcaef6cf8c8cef39f109f1cbb9bae21356e0a) 134 | 135 | ### Features 136 | - openui5_preload task 137 | - Introduce [`compatVersion` option](https://github.com/SAP/grunt-openui5#compatversion) [#47](https://github.com/SAP/grunt-openui5/pull/47) [`cb9bcae`](https://github.com/SAP/grunt-openui5/commit/cb9bcaef6cf8c8cef39f109f1cbb9bae21356e0a) 138 | 139 | ### Others 140 | - Update npm dependencies / replace "url-join" with "urljoin" [#49](https://github.com/SAP/grunt-openui5/pull/49) [`b820a68`](https://github.com/SAP/grunt-openui5/commit/b820a6830cb7505374a10e86816263860f9a52c5) 141 | - Travis CI: Add node v7 / drop v0.10 [`f691e1a`](https://github.com/SAP/grunt-openui5/commit/f691e1a314d9b4d1ff6e540012562639e749276f) 142 | 143 | ### All changes 144 | [`0.10.0...0.11.0`](https://github.com/SAP/grunt-openui5/compare/0.10.0...0.11.0) 145 | 146 | # 0.10.0 - 2016-09-09 147 | 148 | ### Features 149 | - openui5_preload task 150 | - Compression options for UglifyJS [#41](https://github.com/SAP/grunt-openui5/pull/41) [`b2e6c0e`](https://github.com/SAP/grunt-openui5/commit/b2e6c0e87f94d1fc46b8fafa69bd40e8d2ffe88f) 151 | 152 | ### Fixes 153 | - openui5_preload task 154 | - Fail gracefully when minification fails [#42](https://github.com/SAP/grunt-openui5/pull/42) [`52b6c78`](https://github.com/SAP/grunt-openui5/commit/52b6c78d21eec1d90987838d3e7726d19baa8fca) 155 | 156 | ### Others 157 | - Documentation: openui5_theme default example [#33](https://github.com/SAP/grunt-openui5/pull/33) [`8ef82a5`](https://github.com/SAP/grunt-openui5/commit/8ef82a510aed7159c81433d1896fbe7073535426) 158 | 159 | ### All changes 160 | [`0.9.0...0.10.0`](https://github.com/SAP/grunt-openui5/compare/0.9.0...0.10.0) 161 | 162 | 163 | # 0.9.0 - 2016-04-25 164 | 165 | ### Breaking changes 166 | - openui5_connect / openui5_theme tasks 167 | - Set default of parser option `relativeUrls` to `true` [`4d5fca2 ` via less-openui5@0.2.0](https://github.com/SAP/connect-openui5/commit/4d5fca25954049eec4af53c8bd12c54d6ad020aa) (see [`7cc2781 `](https://github.com/SAP/grunt-openui5/commit/7cc2781bfb63c95deef2a63a426d791f02a8770b)) 168 | 169 | ### Features 170 | - openui5_connect task 171 | - support `lessOptions` [`a8c1280`](https://github.com/SAP/grunt-openui5/commit/a8c1280f09a0dc20fd4987600572a8f34e5d9dc4) 172 | 173 | ### Fixes 174 | - openui5_preload task 175 | - Always exclude corresponding preload files [`a9ebf40`](https://github.com/SAP/grunt-openui5/commit/a9ebf407bd4700136b0d7277cdac53d2c6366bb7) 176 | 177 | ### Others 178 | - Support Grunt 1.0 [`046e8ca`](https://github.com/SAP/grunt-openui5/commit/046e8ca5c2ab0954c679712a2b3259c8e2a918dc) 179 | - Update dependencies [`7cc2781`](https://github.com/SAP/grunt-openui5/commit/7cc2781bfb63c95deef2a63a426d791f02a8770b) 180 | 181 | ### All changes 182 | [`0.8.1...0.9.0`](https://github.com/SAP/grunt-openui5/compare/0.8.1...0.9.0) 183 | 184 | 185 | # 0.8.1 - 2016-01-20 186 | 187 | ### Others 188 | - Update dependencies [`4524b2f`](https://github.com/SAP/grunt-openui5/commit/4524b2ffd4b58b5bde777ed4268f013db30ef610) [`70e2c92`](https://github.com/SAP/grunt-openui5/commit/70e2c9286ec26a5a02f7204747abc89f6cf8020a) 189 | 190 | ### All changes 191 | [`0.8.0...0.8.1`](https://github.com/SAP/grunt-openui5/compare/0.8.0...0.8.1) 192 | 193 | 194 | # 0.8.0 - 2015-08-17 195 | 196 | ### Fixes 197 | - openui5_connect task 198 | - support [connect](https://github.com/gruntjs/grunt-contrib-connect) v3 [`b3c9da9`](https://github.com/SAP/grunt-openui5/commit/b3c9da93cd9984ba6bbc391bbdc7745379fa0019) 199 | 200 | ### Others 201 | - bump dependencies [`b3c9da9`](https://github.com/SAP/grunt-openui5/commit/b3c9da93cd9984ba6bbc391bbdc7745379fa0019) 202 | 203 | ### All changes 204 | [`0.7.0...0.8.0`](https://github.com/SAP/grunt-openui5/compare/0.7.0...0.8.0) 205 | 206 | 207 | # 0.7.0 - 2015-03-16 208 | 209 | ### Features 210 | - openui5_connect task 211 | - allow custom middleware (via [connect](https://github.com/gruntjs/grunt-contrib-connect) task [`middleware` function](https://github.com/gruntjs/grunt-contrib-connect#middleware)) [`1cab971`](https://github.com/SAP/grunt-openui5/commit/1cab9712343fe5e0c70fc98ba14e8425718d466e) 212 | - openui5_preload task 213 | - improved error logging / log file compression [`aa16e59`](https://github.com/SAP/grunt-openui5/commit/aa16e59dbb4df9676f89ae8a95234aa289cd9c3d) 214 | 215 | ### Others 216 | - openui5_connect task 217 | - change deprecated usage of server-static "hidden" [`d3911ab`](https://github.com/SAP/grunt-openui5/commit/d3911ab3ce0b3eca8f68a06b0593131b4eb1a7b9) 218 | - bump dependencies [`f949f90`](https://github.com/SAP/grunt-openui5/commit/f949f90eb81190fb39b5102a40ba7c3c60e97621) 219 | 220 | ### All changes 221 | [`0.6.0...0.7.0`](https://github.com/SAP/grunt-openui5/compare/0.6.0...0.7.0) 222 | 223 | 224 | # 0.6.0 - 2015-01-12 225 | 226 | ### Features 227 | - openui5_connect task 228 | - add proxyOptions [`f823c65`](https://github.com/SAP/grunt-openui5/commit/f823c655e72ce940a2b6abc4ee03aaa247a55bed) 229 | 230 | ### Fixes 231 | - openui5_preload task 232 | - error message when no module file could be found [`f6f18ae`](https://github.com/SAP/grunt-openui5/commit/f6f18ae9043846e367ab98f01494b00844e346ca) 233 | 234 | ### All changes 235 | [`0.5.0...0.6.0`](https://github.com/SAP/grunt-openui5/compare/0.5.0...0.6.0) 236 | 237 | 238 | # 0.5.0 - 2014-12-08 239 | 240 | ### Breaking changes 241 | - openui5_library_preload task 242 | - removed, use openui5_preload task instead [`9e8e556`](https://github.com/SAP/grunt-openui5/commit/9e8e55666a548262532b2a84799d68745e796935) 243 | 244 | ### Features 245 | - openui5_preload task 246 | - new task to create preload files for components / libraries [`816507d`](https://github.com/SAP/grunt-openui5/commit/816507d045a11bf9dbb0370d69151ad5f341b6ae) 247 | 248 | ### All changes 249 | [`0.4.0...0.5.0`](https://github.com/SAP/grunt-openui5/compare/0.4.0...0.5.0) 250 | 251 | 252 | # 0.4.0 - 2014-11-21 253 | 254 | ### Breaking changes 255 | - openui5_connect task 256 | - task does only contain `openui5_connect` specific options. All other `connect` options have to be configured in the [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect) task [`91c6261`](https://github.com/SAP/grunt-openui5/commit/91c62612cd4c4c4357602daa4ae35e6ab04abc4f) 257 | 258 | ### Features 259 | - openui5_connect task 260 | - added `proxypath` option to enable a generic proxy [`91c6261`](https://github.com/SAP/grunt-openui5/commit/91c62612cd4c4c4357602daa4ae35e6ab04abc4f) [`1b78fb2`](https://github.com/SAP/grunt-openui5/commit/1b78fb2656549cd64511f638441bcf53df608a87) 261 | - `livereload` option (from [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect#livereload) task) will include an additional LiveReload plugin to enable live-reloading of CSS with source LESS files [`20225e8`](https://github.com/SAP/grunt-openui5/commit/20225e8d6b381e882cd8c885db84b3b7b0eae9af) 262 | 263 | ### All changes 264 | [`0.3.0...0.4.0`](https://github.com/SAP/grunt-openui5/compare/0.3.0...0.4.0) 265 | 266 | 267 | # 0.3.0 - 2014-11-12 268 | 269 | ### Features 270 | - openui5_connect task 271 | - added JS, XML & JSON compression [`011d4af`](https://github.com/SAP/grunt-openui5/commit/011d4afa913d29e9b17702935a7cbdd0bc871a49) [`3905400`](https://github.com/SAP/grunt-openui5/commit/39054000c1bdc12dd445df4c0f1185bfa288f5d1) (thanks to [@olirogers](https://github.com/olirogers)) 272 | 273 | ### All changes 274 | [`0.2.1...0.3.0`](https://github.com/SAP/grunt-openui5/compare/0.2.1...0.3.0) 275 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to grunt-openui5 2 | 3 | In general the contributing guidelines of OpenUI5 also apply to this project. They can be found here: 4 | https://github.com/SAP/openui5/blob/master/CONTRIBUTING.md 5 | 6 | Some parts might not be relevant for this project (e.g. the browser-specific requirements like jQuery, CSS and accessibility in the "Contribution Content Guidelines") and the contribution process is easier (pull requests will be merged directly on GitHub). 7 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function(grunt) { 4 | // Project configuration. 5 | grunt.initConfig({ 6 | 7 | // Before generating any new files, remove any previously-created files. 8 | "clean": { 9 | tests: [ 10 | "tmp", 11 | "test/preload/fixtures/app-same-dest/my/app/Component-preload.js", 12 | "test/preload/fixtures/library-same-dest/my/ui/lib/library-preload.json" 13 | ] 14 | }, 15 | 16 | // Configuration to be run (and then tested). 17 | "openui5_theme": { 18 | "default_options": { 19 | options: {}, 20 | files: [ 21 | { 22 | expand: true, 23 | cwd: "test/theme/fixtures/lib1/my/theme/foo", 24 | src: "foo.less", 25 | dest: "tmp/theme/default_options" 26 | } 27 | ] 28 | }, 29 | "compress_option": { 30 | options: { 31 | compiler: { 32 | compress: true 33 | } 34 | }, 35 | files: [ 36 | { 37 | expand: true, 38 | cwd: "test/theme/fixtures/lib1/my/theme/foo", 39 | src: "foo.less", 40 | dest: "tmp/theme/compress_option" 41 | } 42 | ] 43 | }, 44 | "rootPaths_option": { 45 | options: { 46 | rootPaths: [ 47 | "test/theme/fixtures/lib1", 48 | "test/theme/fixtures/lib2" 49 | ] 50 | }, 51 | files: [ 52 | { 53 | expand: true, 54 | cwd: "test/theme/fixtures/lib2/my/theme/bar", 55 | src: "bar.less", 56 | dest: "tmp/theme/rootPaths_option" 57 | } 58 | ] 59 | } 60 | }, 61 | 62 | // Configuration to be run (and then tested). 63 | "openui5_preload": { 64 | 65 | "component_default_options": { 66 | options: { 67 | resources: "test/preload/fixtures/app", 68 | dest: "tmp/preload/component_default_options" 69 | }, 70 | components: "**" 71 | }, 72 | 73 | "component_resource_prefix": { 74 | options: { 75 | resources: [ 76 | { 77 | cwd: "test/preload/fixtures/app/my/app", 78 | prefix: "my/app" 79 | } 80 | ], 81 | dest: "tmp/preload/component_resource_prefix" 82 | }, 83 | components: "my/app" 84 | }, 85 | 86 | "component_no_compress": { 87 | options: { 88 | resources: "test/preload/fixtures/app", 89 | dest: "tmp/preload/component_no_compress", 90 | compress: false 91 | }, 92 | components: "**" 93 | }, 94 | 95 | // The following two targets are testing that a generated preload file 96 | // doesn't get included when runnign the preload again 97 | // (same folder for src and dest) 98 | "component_same_dest_1": { 99 | options: { 100 | resources: "test/preload/fixtures/app-same-dest", 101 | dest: "test/preload/fixtures/app-same-dest" 102 | }, 103 | components: "**" 104 | }, 105 | "component_same_dest_2": { 106 | options: { 107 | resources: "test/preload/fixtures/app-same-dest", 108 | dest: "test/preload/fixtures/app-same-dest" 109 | }, 110 | components: "**" 111 | }, 112 | 113 | "component_compat_140": { 114 | options: { 115 | resources: "test/preload/fixtures/app", 116 | dest: "tmp/preload/component_compat_140", 117 | compatVersion: "1.40" 118 | }, 119 | components: "**" 120 | }, 121 | 122 | "component_compat_154": { 123 | options: { 124 | resources: "test/preload/fixtures/app", 125 | dest: "tmp/preload/component_compat_154", 126 | compatVersion: "1.54" 127 | }, 128 | components: "**" 129 | }, 130 | 131 | "library_default_options": { 132 | options: { 133 | resources: "test/preload/fixtures/library", 134 | dest: "tmp/preload/library_default_options" 135 | }, 136 | libraries: "**" 137 | }, 138 | 139 | "library_compat_138": { 140 | options: { 141 | resources: "test/preload/fixtures/library", 142 | dest: "tmp/preload/library_compat_138", 143 | compatVersion: "1.38" 144 | }, 145 | libraries: "**" 146 | }, 147 | 148 | "library_compat_140": { 149 | options: { 150 | resources: "test/preload/fixtures/library", 151 | dest: "tmp/preload/library_compat_140", 152 | compatVersion: "1.40" 153 | }, 154 | libraries: "**" 155 | }, 156 | 157 | "library_compat_154": { 158 | options: { 159 | resources: "test/preload/fixtures/library", 160 | dest: "tmp/preload/library_compat_154", 161 | compatVersion: "1.54" 162 | }, 163 | libraries: "**" 164 | }, 165 | 166 | "library_resource_prefix": { 167 | options: { 168 | resources: [ 169 | { 170 | cwd: "test/preload/fixtures/library/my/ui/lib", 171 | prefix: "my/ui/lib" 172 | } 173 | ], 174 | dest: "tmp/preload/library_resource_prefix" 175 | }, 176 | libraries: "my/ui/lib" 177 | }, 178 | 179 | "library_no_compress": { 180 | options: { 181 | resources: "test/preload/fixtures/library", 182 | dest: "tmp/preload/library_no_compress", 183 | compress: false 184 | }, 185 | libraries: "**" 186 | }, 187 | 188 | // The following two targets are testing that a generated preload file 189 | // doesn't get included when runnign the preload again 190 | // (same folder for src and dest) 191 | "library_same_dest_1": { 192 | options: { 193 | resources: [ 194 | { 195 | cwd: "test/preload/fixtures/library-same-dest", 196 | src: [ 197 | // Defaults 198 | "**/*.js", 199 | "**/*.fragment.html", 200 | "**/*.fragment.json", 201 | "**/*.fragment.xml", 202 | "**/*.view.html", 203 | "**/*.view.json", 204 | "**/*.view.xml", 205 | "**/*.properties", 206 | // Include "library-preload.json" for this test 207 | "**/library-preload.json" 208 | ] 209 | } 210 | ], 211 | dest: "test/preload/fixtures/library-same-dest" 212 | }, 213 | libraries: "**" 214 | }, 215 | "library_same_dest_2": { 216 | options: { 217 | resources: [ 218 | { 219 | cwd: "test/preload/fixtures/library-same-dest", 220 | src: [ 221 | // Defaults 222 | "**/*.js", 223 | "**/*.fragment.html", 224 | "**/*.fragment.json", 225 | "**/*.fragment.xml", 226 | "**/*.view.html", 227 | "**/*.view.json", 228 | "**/*.view.xml", 229 | "**/*.properties", 230 | // Include "library-preload.json" for this test 231 | "**/library-preload.json" 232 | ] 233 | } 234 | ], 235 | dest: "test/preload/fixtures/library-same-dest" 236 | }, 237 | libraries: "**" 238 | }, 239 | 240 | "library_custom_terser_params": { 241 | options: { 242 | resources: "test/preload/fixtures/library-custom-terser-params", 243 | dest: "tmp/preload/library_custom_terser_params", 244 | compress: { 245 | terser: { 246 | mangle: false, 247 | output: { 248 | ascii_only: true 249 | } 250 | } 251 | } 252 | }, 253 | libraries: "**" 254 | }, 255 | 256 | "library_custom_uglify_params": { 257 | options: { 258 | resources: "test/preload/fixtures/library-custom-uglify-params", 259 | dest: "tmp/preload/library_custom_uglify_params", 260 | compress: { 261 | uglifyjs: { 262 | mangle: false, 263 | output: { 264 | ascii_only: true 265 | } 266 | } 267 | } 268 | }, 269 | libraries: "**" 270 | } 271 | 272 | }, 273 | 274 | "connect": { 275 | 276 | connectTest: { 277 | options: { 278 | port: 8080, 279 | middleware: function(connect, options, middlewares) { 280 | middlewares.push(["/foo", function(req, res, next) { 281 | res.end("bar"); 282 | }]); 283 | return middlewares; 284 | } 285 | } 286 | }, 287 | 288 | serverToBeProxified: { 289 | options: { 290 | port: 9000 291 | } 292 | } 293 | 294 | }, 295 | 296 | "openui5_connect": { 297 | 298 | connectTest: { 299 | options: { 300 | appresources: [ 301 | "test/connect/fixtures", 302 | "test/connect/fixtures/app" 303 | ], 304 | resources: [ 305 | "test/connect/fixtures/someLib/resources", 306 | "test/connect/fixtures/anotherLib/res" 307 | ], 308 | testresources: [ 309 | "test/connect/fixtures/someLib/test-resources", 310 | "test/connect/fixtures/anotherLib/testres" 311 | ], 312 | contextpath: "mycontext", 313 | proxypath: "proxy" 314 | } 315 | }, 316 | 317 | serverToBeProxified: { 318 | options: { 319 | appresources: [ 320 | "test/connect/fixtures", 321 | "test/connect/fixtures/app" 322 | ], 323 | resources: [ 324 | "test/connect/fixtures/someLib/resources", 325 | "test/connect/fixtures/anotherLib/res" 326 | ], 327 | testresources: [ 328 | "test/connect/fixtures/someLib/test-resources", 329 | "test/connect/fixtures/anotherLib/testres" 330 | ], 331 | contextpath: "mycontext" 332 | } 333 | } 334 | 335 | }, 336 | 337 | // Unit tests. 338 | "mochaTest": { 339 | tests: { 340 | src: ["test/*_test.js"] 341 | } 342 | } 343 | 344 | }); 345 | 346 | // Actually load this plugin's task(s). 347 | grunt.loadTasks("tasks"); 348 | 349 | // These plugins provide necessary tasks. 350 | grunt.loadNpmTasks("grunt-contrib-connect"); 351 | grunt.loadNpmTasks("grunt-contrib-clean"); 352 | grunt.loadNpmTasks("grunt-mocha-test"); 353 | 354 | // Whenever the "test" task is run, first clean the "tmp" dir, then run this 355 | // plugin's task(s), then test the result. 356 | grunt.registerTask("test", [ 357 | "clean", 358 | 359 | "openui5_theme", 360 | "openui5_preload", 361 | "openui5_connect", 362 | 363 | "mochaTest:tests" 364 | ]); 365 | 366 | // By default, lint and run all tests. 367 | grunt.registerTask("default", ["test"]); 368 | }; 369 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 SAP SE or an SAP affiliate company. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSES/Apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, 6 | AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | 11 | 12 | "License" shall mean the terms and conditions for use, reproduction, and distribution 13 | as defined by Sections 1 through 9 of this document. 14 | 15 | 16 | 17 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 18 | owner that is granting the License. 19 | 20 | 21 | 22 | "Legal Entity" shall mean the union of the acting entity and all other entities 23 | that control, are controlled by, or are under common control with that entity. 24 | For the purposes of this definition, "control" means (i) the power, direct 25 | or indirect, to cause the direction or management of such entity, whether 26 | by contract or otherwise, or (ii) ownership of fifty percent (50%) or more 27 | of the outstanding shares, or (iii) beneficial ownership of such entity. 28 | 29 | 30 | 31 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions 32 | granted by this License. 33 | 34 | 35 | 36 | "Source" form shall mean the preferred form for making modifications, including 37 | but not limited to software source code, documentation source, and configuration 38 | files. 39 | 40 | 41 | 42 | "Object" form shall mean any form resulting from mechanical transformation 43 | or translation of a Source form, including but not limited to compiled object 44 | code, generated documentation, and conversions to other media types. 45 | 46 | 47 | 48 | "Work" shall mean the work of authorship, whether in Source or Object form, 49 | made available under the License, as indicated by a copyright notice that 50 | is included in or attached to the work (an example is provided in the Appendix 51 | below). 52 | 53 | 54 | 55 | "Derivative Works" shall mean any work, whether in Source or Object form, 56 | that is based on (or derived from) the Work and for which the editorial revisions, 57 | annotations, elaborations, or other modifications represent, as a whole, an 58 | original work of authorship. For the purposes of this License, Derivative 59 | Works shall not include works that remain separable from, or merely link (or 60 | bind by name) to the interfaces of, the Work and Derivative Works thereof. 61 | 62 | 63 | 64 | "Contribution" shall mean any work of authorship, including the original version 65 | of the Work and any modifications or additions to that Work or Derivative 66 | Works thereof, that is intentionally submitted to Licensor for inclusion in 67 | the Work by the copyright owner or by an individual or Legal Entity authorized 68 | to submit on behalf of the copyright owner. For the purposes of this definition, 69 | "submitted" means any form of electronic, verbal, or written communication 70 | sent to the Licensor or its representatives, including but not limited to 71 | communication on electronic mailing lists, source code control systems, and 72 | issue tracking systems that are managed by, or on behalf of, the Licensor 73 | for the purpose of discussing and improving the Work, but excluding communication 74 | that is conspicuously marked or otherwise designated in writing by the copyright 75 | owner as "Not a Contribution." 76 | 77 | 78 | 79 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 80 | of whom a Contribution has been received by Licensor and subsequently incorporated 81 | within the Work. 82 | 83 | 2. Grant of Copyright License. Subject to the terms and conditions of this 84 | License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 85 | no-charge, royalty-free, irrevocable copyright license to reproduce, prepare 86 | Derivative Works of, publicly display, publicly perform, sublicense, and distribute 87 | the Work and such Derivative Works in Source or Object form. 88 | 89 | 3. Grant of Patent License. Subject to the terms and conditions of this License, 90 | each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 91 | no-charge, royalty-free, irrevocable (except as stated in this section) patent 92 | license to make, have made, use, offer to sell, sell, import, and otherwise 93 | transfer the Work, where such license applies only to those patent claims 94 | licensable by such Contributor that are necessarily infringed by their Contribution(s) 95 | alone or by combination of their Contribution(s) with the Work to which such 96 | Contribution(s) was submitted. If You institute patent litigation against 97 | any entity (including a cross-claim or counterclaim in a lawsuit) alleging 98 | that the Work or a Contribution incorporated within the Work constitutes direct 99 | or contributory patent infringement, then any patent licenses granted to You 100 | under this License for that Work shall terminate as of the date such litigation 101 | is filed. 102 | 103 | 4. Redistribution. You may reproduce and distribute copies of the Work or 104 | Derivative Works thereof in any medium, with or without modifications, and 105 | in Source or Object form, provided that You meet the following conditions: 106 | 107 | (a) You must give any other recipients of the Work or Derivative Works a copy 108 | of this License; and 109 | 110 | (b) You must cause any modified files to carry prominent notices stating that 111 | You changed the files; and 112 | 113 | (c) You must retain, in the Source form of any Derivative Works that You distribute, 114 | all copyright, patent, trademark, and attribution notices from the Source 115 | form of the Work, excluding those notices that do not pertain to any part 116 | of the Derivative Works; and 117 | 118 | (d) If the Work includes a "NOTICE" text file as part of its distribution, 119 | then any Derivative Works that You distribute must include a readable copy 120 | of the attribution notices contained within such NOTICE file, excluding those 121 | notices that do not pertain to any part of the Derivative Works, in at least 122 | one of the following places: within a NOTICE text file distributed as part 123 | of the Derivative Works; within the Source form or documentation, if provided 124 | along with the Derivative Works; or, within a display generated by the Derivative 125 | Works, if and wherever such third-party notices normally appear. The contents 126 | of the NOTICE file are for informational purposes only and do not modify the 127 | License. You may add Your own attribution notices within Derivative Works 128 | that You distribute, alongside or as an addendum to the NOTICE text from the 129 | Work, provided that such additional attribution notices cannot be construed 130 | as modifying the License. 131 | 132 | You may add Your own copyright statement to Your modifications and may provide 133 | additional or different license terms and conditions for use, reproduction, 134 | or distribution of Your modifications, or for any such Derivative Works as 135 | a whole, provided Your use, reproduction, and distribution of the Work otherwise 136 | complies with the conditions stated in this License. 137 | 138 | 5. Submission of Contributions. Unless You explicitly state otherwise, any 139 | Contribution intentionally submitted for inclusion in the Work by You to the 140 | Licensor shall be under the terms and conditions of this License, without 141 | any additional terms or conditions. Notwithstanding the above, nothing herein 142 | shall supersede or modify the terms of any separate license agreement you 143 | may have executed with Licensor regarding such Contributions. 144 | 145 | 6. Trademarks. This License does not grant permission to use the trade names, 146 | trademarks, service marks, or product names of the Licensor, except as required 147 | for reasonable and customary use in describing the origin of the Work and 148 | reproducing the content of the NOTICE file. 149 | 150 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to 151 | in writing, Licensor provides the Work (and each Contributor provides its 152 | Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 153 | KIND, either express or implied, including, without limitation, any warranties 154 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR 155 | A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness 156 | of using or redistributing the Work and assume any risks associated with Your 157 | exercise of permissions under this License. 158 | 159 | 8. Limitation of Liability. In no event and under no legal theory, whether 160 | in tort (including negligence), contract, or otherwise, unless required by 161 | applicable law (such as deliberate and grossly negligent acts) or agreed to 162 | in writing, shall any Contributor be liable to You for damages, including 163 | any direct, indirect, special, incidental, or consequential damages of any 164 | character arising as a result of this License or out of the use or inability 165 | to use the Work (including but not limited to damages for loss of goodwill, 166 | work stoppage, computer failure or malfunction, or any and all other commercial 167 | damages or losses), even if such Contributor has been advised of the possibility 168 | of such damages. 169 | 170 | 9. Accepting Warranty or Additional Liability. While redistributing the Work 171 | or Derivative Works thereof, You may choose to offer, and charge a fee for, 172 | acceptance of support, warranty, indemnity, or other liability obligations 173 | and/or rights consistent with this License. However, in accepting such obligations, 174 | You may act only on Your own behalf and on Your sole responsibility, not on 175 | behalf of any other Contributor, and only if You agree to indemnify, defend, 176 | and hold each Contributor harmless for any liability incurred by, or claims 177 | asserted against, such Contributor by reason of your accepting any such warranty 178 | or additional liability. END OF TERMS AND CONDITIONS 179 | 180 | APPENDIX: How to apply the Apache License to your work. 181 | 182 | To apply the Apache License to your work, attach the following boilerplate 183 | notice, with the fields enclosed by brackets "[]" replaced with your own identifying 184 | information. (Don't include the brackets!) The text should be enclosed in 185 | the appropriate comment syntax for the file format. We also recommend that 186 | a file or class name and description of purpose be included on the same "printed 187 | page" as the copyright notice for easier identification within third-party 188 | archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | 194 | you may not use this file except in compliance with the License. 195 | 196 | You may obtain a copy of the License at 197 | 198 | http://www.apache.org/licenses/LICENSE-2.0 199 | 200 | Unless required by applicable law or agreed to in writing, software 201 | 202 | distributed under the License is distributed on an "AS IS" BASIS, 203 | 204 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 205 | 206 | See the License for the specific language governing permissions and 207 | 208 | limitations under the License. 209 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![OpenUI5](http://openui5.org/images/OpenUI5_new_big_side.png) 2 | 3 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP/grunt-openui5)](https://api.reuse.software/info/github.com/SAP/grunt-openui5) 4 | [![Build Status](http://img.shields.io/travis/SAP/grunt-openui5.svg?style=flat)](https://travis-ci.org/SAP/grunt-openui5) 5 | [![NPM Version](http://img.shields.io/npm/v/grunt-openui5.svg?style=flat)](https://www.npmjs.org/package/grunt-openui5) 6 | 7 | # DEPRECATED 8 | 9 | **⚠️ This project has been deprecated in favor of [UI5 Tooling](https://sap.github.io/ui5-tooling/).** 10 | 11 | # grunt-openui5 12 | 13 | > Grunt tasks around OpenUI5 14 | 15 | ## Getting Started 16 | This plugin requires Grunt `~0.4.5` 17 | 18 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 19 | 20 | ```shell 21 | npm install grunt-openui5 --save-dev 22 | ``` 23 | 24 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: 25 | 26 | ```js 27 | grunt.loadNpmTasks('grunt-openui5'); 28 | ``` 29 | 30 | ## openui5_theme 31 | 32 | ### Overview 33 | 34 | Builds a theme and creates the following files in the dest directory of the specified less file 35 | - library.css (regular css) 36 | - library-RTL.css (mirrored css for right-to-left support) 37 | - library-parameters.json (key-value map of all global less variables) 38 | 39 | ### Options 40 | 41 | #### rootPaths 42 | Type: `array` of `string` 43 | 44 | Root paths to use for import directives. 45 | 46 | This option differs from the `parser.paths` option. 47 | It is useful if less files are located in separate folders but referenced as they would all be in one. 48 | If `rootPaths` are provided and a file can not be found, the `parser.paths` option will be used instead. 49 | 50 | #### parser 51 | 52 | Type: `object` 53 | 54 | Options for the [less](http://lesscss.org) parser (`less.Parser`). 55 | 56 | #### compiler 57 | 58 | Type `object` 59 | 60 | Options for the [less](http://lesscss.org) compiler (`tree.toCss`). 61 | 62 | **Note:** The options `sourceMap` and `cleancss` are not supported. An exception will be thrown when used. 63 | 64 | ### Usage Examples 65 | 66 | #### Default Options 67 | 68 | ```js 69 | grunt.initConfig({ 70 | openui5_theme: { 71 | library: { 72 | files: [ 73 | { 74 | expand: true, 75 | cwd: 'lib1', 76 | src: 'my/ui/lib/themes/foo/library.source.less', 77 | dest: 'tmp' 78 | } 79 | ] 80 | } 81 | }, 82 | }); 83 | ``` 84 | 85 | Creates the following files 86 | - tmp/my/ui/lib/themes/foo/library.css 87 | - tmp/my/ui/lib/themes/foo/library-RTL.css 88 | - tmp/my/ui/lib/themes/foo/library-parameters.json 89 | 90 | #### Custom Options 91 | 92 | If import directives are used to import files from other src folders, the root paths should be defined. 93 | The compress option can be used to minify the output css/json. 94 | 95 | ```js 96 | grunt.initConfig({ 97 | openui5: { 98 | options: { 99 | rootPaths: [ 100 | 'lib1', 101 | 'lib2' 102 | ], 103 | compiler: { 104 | compress: true 105 | } 106 | }, 107 | library: { 108 | files: [ 109 | { 110 | expand: true, 111 | cwd: 'lib2', 112 | src: 'my/ui/lib/themes/bar/library.source.less', 113 | dest: 'tmp' 114 | } 115 | ] 116 | } 117 | }, 118 | }); 119 | ``` 120 | 121 | Creates the following files 122 | - tmp/my/ui/lib/themes/bar/library.css 123 | - tmp/my/ui/lib/themes/bar/library-RTL.css 124 | - tmp/my/ui/lib/themes/bar/library-parameters.json 125 | 126 | ## openui5_preload 127 | 128 | ### Overview 129 | 130 | Task to merge multiple files into one preload file. 131 | 132 | ### Options 133 | 134 | #### resources 135 | Type: `string` or `array` or `object` 136 | 137 | Resources/files that should be used as source for preload files. 138 | 139 | Type | Result | Example 140 | -------- | ---------------------------------- | ------- 141 | *String* | See `cwd`. | `'src'` 142 | *Array* | Array of `string` and/or `object`. | `[ 'src', { cwd: 'webapp', prefix: 'my/app' } ]` 143 | *Object* | See `cwd`, `prefix` and `src` | `{ cwd: 'webapp', prefix: 'my/app', src: '**' }` 144 | 145 | ##### cwd 146 | Type: `string` 147 | 148 | Base/root directory for finding resources. 149 | 150 | ##### prefix 151 | Type: `string` 152 | Default: ` ` 153 | 154 | Directory namespace prefix that should be prepended to all found paths. This is useful if the source folder structure is not the same as the module namespace. 155 | 156 | Example: 157 | `{ cwd: 'webapp', prefix: 'my/app' }` 158 | `webapp/foo.js` will be treated as `my/app/foo.js` instead of `foo.js`. 159 | 160 | ##### src 161 | Type: `string` or `array` of `string` 162 | Default: 163 | ``` 164 | [ 165 | '**/*.js', 166 | '**/*.fragment.html', 167 | '**/*.fragment.json', 168 | '**/*.fragment.xml', 169 | '**/*.view.html', 170 | '**/*.view.json', 171 | '**/*.view.xml', 172 | '**/*.properties' 173 | ] 174 | ``` 175 | 176 | Glob pattern(s) for finding relevant resources inside `cwd`. If set, the default patterns will be replaced. 177 | 178 | #### compatVersion 179 | Type: `string` 180 | Default: `edge` 181 | 182 | Sets the UI5 version used for compatibility mode in the format `.`. Use this when building older UI5 releases to ensure full functionality. 183 | 184 | Example: 185 | When building for UI5 target version 1.38.x, use `compatVersion: '1.38'`. 186 | 187 | #### dest 188 | Type: `string` 189 | Default value: `.` 190 | 191 | Path to the dest folder in which the preload files should be created. 192 | 193 | #### compress 194 | Type: `boolean` or `object` 195 | Default value: `true` 196 | 197 | Optional parameter to set compression/minification of the files or to provide 198 | additional options. 199 | 200 | - JavaScript is minified using [terser](https://github.com/terser/terser) 201 | - XML is minified using [pretty-data](https://github.com/vkiryukhin/pretty-data) 202 | - JSON is parsed for correctness and to remove extra whitespace 203 | 204 | An `object` can be used to provide options. 205 | Provide a `terser` object with the options. `uglifyjs` is also supported for backwards compatibility reasons. 206 | The given object will be passed to `minify` (see [here](https://github.com/terser/terser#format-options) for options) and merged with the defaults (see below). 207 | 208 | ```js 209 | compress: { 210 | terser: { 211 | output: { 212 | comments: /copyright|\(c\)|released under|license|\u00a9/i 213 | } 214 | } 215 | } 216 | ``` 217 | 218 | #### components 219 | 220 | ##### `boolean` 221 | 222 | Enable auto detection of Components. A preload file will be created for each `Component.js` file. 223 | 224 | ```js 225 | components: true 226 | ``` 227 | 228 | ##### `string` / `array` of `string` 229 | 230 | Namespace path(s) to Component(s). 231 | 232 | ```js 233 | components: 'my/app', 234 | components: [ 'my/app', 'my/component'] 235 | ``` 236 | 237 | ##### `object` 238 | 239 | Map with namespace path to Component as key and object as value. 240 | 241 | ```js 242 | components: { 243 | 'my/app': { 244 | src: [ 245 | 'my/app/**', 246 | 'my/app/!ignore.js' 247 | ] 248 | } 249 | } 250 | ``` 251 | 252 | ##### src 253 | Type: `string` / `array` of `string` 254 | Default: component namespace path + `/**` (e.g. `my/app/**`) 255 | 256 | Glob pattern(s) for files that should be included into the preload. 257 | Patterns are based on all available resources (see [resources](#resources)). 258 | 259 | ### libraries 260 | 261 | See [components](#components). Auto mode is looking for `library.js` files. 262 | 263 | ### Usage Examples 264 | 265 | #### Component 266 | 267 | Creates `dist/Component-preload.js`. 268 | 269 | ```js 270 | grunt.initConfig({ 271 | 272 | openui5_preload: { 273 | 274 | component: { 275 | options: { 276 | resources: { 277 | cwd: 'webapp', 278 | prefix: 'my/app' 279 | }, 280 | dest: 'dist' 281 | }, 282 | components: 'my/app' 283 | } 284 | 285 | } 286 | 287 | }); 288 | ``` 289 | 290 | #### Library 291 | 292 | Creates `dist/my/ui/lib/library-preload.json`. 293 | 294 | ```js 295 | grunt.initConfig({ 296 | 297 | openui5_preload: { 298 | library: { 299 | options: { 300 | resources: 'src', 301 | dest: 'dist' 302 | }, 303 | libraries: 'my/ui/lib' 304 | } 305 | } 306 | 307 | }); 308 | ``` 309 | 310 | ## openui5_connect 311 | 312 | ### Overview 313 | 314 | Provides middleware for the [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect) task to run a web server. 315 | This task will configure the `connect` task target with the same name and invoke it with the provided arguments. 316 | As this task creates it's own middleware, the `connect` task's `base` option will not be respected. If you want to modify the middleware, provide a function callback as `middleware` option (see [here](https://github.com/gruntjs/grunt-contrib-connect#middleware)). The function will be called after the middleware has been created. 317 | 318 | ### Options 319 | 320 | > Note: This task provides options on top of the `connect` task. For general options, see [grunt-contrib-connect](https://github.com/gruntjs/grunt-contrib-connect#connect-task). 321 | 322 | #### contextpath 323 | 324 | Type: `string` 325 | Default value: `/` 326 | 327 | The contextpath for all middlewares provided by this task. 328 | 329 | #### appresources 330 | 331 | Type: `array` of `string` 332 | 333 | Directories that should be served under the root `/` path. 334 | 335 | Example 336 | ```js 337 | appresources: 'webapp' 338 | ``` 339 | ``` 340 | webapp 341 | - dir 342 | - index.html 343 | ``` 344 | `http://localhost/contextpath/dir/index.html` 345 | 346 | #### resources 347 | 348 | Type: `array` of `string` 349 | 350 | Directories that should be served under the `/resources` path. 351 | 352 | Example 353 | ```js 354 | resources: 'src' 355 | ``` 356 | ``` 357 | src 358 | - my 359 | - lib 360 | - Button.js 361 | ``` 362 | `http://localhost/contextpath/resources/my/lib/Button.js` 363 | 364 | #### testresources 365 | 366 | Type: `array` of `string` 367 | 368 | Directories that should be served under the `/test-resources` path. 369 | 370 | Example 371 | ```js 372 | testresources: 'test' 373 | ``` 374 | ``` 375 | test 376 | - my 377 | - lib 378 | - Button.html 379 | ``` 380 | `http://localhost/contextpath/test-resources/my/lib/Button.html` 381 | 382 | #### cors 383 | 384 | Type: `object` 385 | Default: `null` 386 | 387 | Configuration for [node-cors](https://github.com/troygoode/node-cors/) to enable Cross Origin Resource Sharing (CORS). 388 | 389 | Example 390 | ```js 391 | cors: { 392 | origin: '*' 393 | } 394 | ``` 395 | 396 | #### proxypath 397 | 398 | Type: `string` 399 | 400 | If set, a generic proxy under the specified path will be provided to consume resources from other origins without causing CORS issues. 401 | 402 | URL-Format: `proxypath/{http|https}/{host}/{path}` 403 | 404 | Example 405 | ```js 406 | proxypath: 'proxy' 407 | ``` 408 | `http://localhost/contextpath/proxy/http/example.com/foo` 409 | 410 | #### proxyOptions 411 | 412 | Type: `object` 413 | 414 | Options for [connect-openui5 proxy](https://github.com/SAP/connect-openui5#proxyoptions). 415 | 416 | #### lessOptions 417 | 418 | Type: `object` 419 | 420 | Options for [connect-openui5 less](https://github.com/SAP/connect-openui5#lessoptions). 421 | 422 | 423 | ### Usage Examples 424 | 425 | #### App 426 | 427 | This example will run a web server at `http://localhost:8000/`. 428 | It serves the `webapp` directory at root level and the openui5 resources at `http://localhost:8000/resources/*`. 429 | 430 | ```js 431 | connect: { 432 | server: { 433 | options: { 434 | port: 8000 435 | } 436 | } 437 | }, 438 | 439 | openui5_connect: { 440 | server: { 441 | options: { 442 | appresources: 'webapp', 443 | resources: 'path/to/openui5/resources' 444 | } 445 | } 446 | } 447 | ``` 448 | 449 | #### Custom middleware 450 | 451 | This example will add custom middleware before (unshift) and after (push) the middlewares created by this task. 452 | 453 | ```js 454 | connect: { 455 | server: { 456 | options: { 457 | port: 8000, 458 | middleware: function(connect, options, middlewares) { 459 | middlewares.unshift(function(req, res, next) { 460 | // before openui5 middleware 461 | }); 462 | middlewares.push(function(req, res, next) { 463 | // after openui5 middleware 464 | }); 465 | return middlewares; 466 | } 467 | } 468 | } 469 | }, 470 | 471 | openui5_connect: { 472 | server: { 473 | options: { 474 | appresources: 'webapp', 475 | resources: 'path/to/openui5/resources' 476 | } 477 | } 478 | } 479 | ``` 480 | 481 | ## Contributing 482 | 483 | See [CONTRIBUTING.md](CONTRIBUTING.md). 484 | 485 | ## Release History 486 | 487 | See [CHANGELOG.md](CHANGELOG.md). 488 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Issues 2 | 3 | We take security issues in our projects seriously. We appreciate your efforts to responsibly disclose your findings. 4 | 5 | Please do not report security issues directly on GitHub but using one of the channels listed below. This allows us to provide a fix before an issue can be exploited. 6 | 7 | - **Researchers/Non-SAP Customers:** Please consult SAPs [disclosure guidelines](https://wiki.scn.sap.com/wiki/display/PSR/Disclosure+Guidelines+for+SAP+Security+Advisories) and send the related information in a PGP encrypted e-mail to secure@sap.com. Find the public PGP key [here](https://www.sap.com/dmc/policies/pgp/keyblock.txt). 8 | - **SAP Customers:** If the security issue is not covered by a published security note, please report it by creating a customer message at https://launchpad.support.sap.com. 9 | 10 | Please also refer to the general [SAP security information page](https://www.sap.com/about/trust-center/security/incident-management.html). 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-openui5", 3 | "version": "0.18.4", 4 | "description": "Grunt tasks around OpenUI5", 5 | "author": { 6 | "name": "SAP SE", 7 | "email": "openui5@sap.com", 8 | "url": "https://www.sap.com" 9 | }, 10 | "license": "Apache-2.0", 11 | "keywords": [ 12 | "openui5", 13 | "sapui5", 14 | "ui5", 15 | "gruntplugin" 16 | ], 17 | "engines": { 18 | "node": ">= 10", 19 | "npm": ">= 5" 20 | }, 21 | "scripts": { 22 | "lint": "eslint ./", 23 | "unit": "grunt", 24 | "coverage": "nyc npm run unit", 25 | "test": "npm run lint && npm run coverage && npm run depcheck", 26 | "preversion": "npm test", 27 | "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md v0.16.0.. && git add CHANGELOG.md", 28 | "postversion": "git push --follow-tags", 29 | "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version", 30 | "depcheck": "depcheck" 31 | }, 32 | "files": [ 33 | "tasks", 34 | "LICENSE.txt", 35 | "LICENSES/**", 36 | ".reuse/**" 37 | ], 38 | "nyc": { 39 | "reporter": [ 40 | "lcov", 41 | "text", 42 | "text-summary" 43 | ], 44 | "exclude": [ 45 | "coverage/**", 46 | "test/**", 47 | ".eslintrc.js", 48 | "tmp/**" 49 | ], 50 | "check-coverage": true, 51 | "statements": 85, 52 | "branches": 75, 53 | "functions": 90, 54 | "lines": 85, 55 | "watermarks": { 56 | "statements": [ 57 | 70, 58 | 90 59 | ], 60 | "branches": [ 61 | 70, 62 | 90 63 | ], 64 | "functions": [ 65 | 70, 66 | 90 67 | ], 68 | "lines": [ 69 | 70, 70 | 90 71 | ] 72 | }, 73 | "cache": true, 74 | "all": true 75 | }, 76 | "repository": { 77 | "type": "git", 78 | "url": "git@github.com:SAP/grunt-openui5.git" 79 | }, 80 | "peerDependencies": { 81 | "grunt": ">=0.4.0" 82 | }, 83 | "dependencies": { 84 | "async": "^3.2.4", 85 | "connect-inject": "^0.4.0", 86 | "connect-openui5": "^0.10.3", 87 | "cors": "^2.8.5", 88 | "less-openui5": "^0.11.6", 89 | "maxmin": "^3.0.0", 90 | "pretty-data": "^0.40.0", 91 | "serve-static": "^1.15.0", 92 | "slash": "^3.0.0", 93 | "terser": "^5.17.4", 94 | "urljoin": "^0.1.5" 95 | }, 96 | "devDependencies": { 97 | "depcheck": "^1.4.3", 98 | "eslint": "^7.32.0", 99 | "eslint-config-google": "^0.14.0", 100 | "grunt": "^1.6.1", 101 | "grunt-contrib-clean": "^2.0.1", 102 | "grunt-contrib-connect": "^3.0.0", 103 | "grunt-mocha-test": "^0.13.3", 104 | "mocha": "^8.4.0", 105 | "nyc": "^15.1.0" 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /tasks/connect.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const openui5 = { 4 | connect: require("connect-openui5") 5 | }; 6 | const serveStatic = require("serve-static"); 7 | const inject = require("connect-inject"); 8 | const cors = require("cors"); 9 | const urljoin = require("urljoin"); 10 | 11 | const liveReloadLessCssPlugin = ` 12 | var LiveReloadPluginLessCss = function(window, host) { 13 | this.window = window; 14 | this.host = host; 15 | }; 16 | LiveReloadPluginLessCss.identifier = 'less_css'; 17 | LiveReloadPluginLessCss.version = '1.0'; 18 | LiveReloadPluginLessCss.prototype.reload = function(path, options) { 19 | // do only run this if less is not loaded (LiveReload LessPlugin will handle this) 20 | if (!this.window.less) { 21 | // reload stylesheets (css) also if a less file was changed 22 | if (path.match(/\\.less$/i)) { 23 | return this.window.LiveReload.reloader.reloadStylesheet(path); 24 | } 25 | if (options.originalPath.match(/\\.less$/i)) { 26 | return this.window.LiveReload.reloader.reloadStylesheet(options.originalPath); 27 | } 28 | } 29 | return false; 30 | }; 31 | LiveReloadPluginLessCss.prototype.analyze = function() { 32 | // disable the plugin if less is loaded (LiveReload LessPlugin will handle this) 33 | return { 34 | disable: (this.window.less && this.window.less.refresh) 35 | }; 36 | };`; 37 | 38 | module.exports = function(grunt, config) { 39 | grunt.registerMultiTask("openui5_connect", "Grunt task to start an OpenUI5 connect server", function() { 40 | // Merge task-specific and/or target-specific options with these defaults. 41 | const options = this.options({ 42 | contextpath: "/", 43 | appresources: [], 44 | resources: [], 45 | testresources: [], 46 | cors: null, 47 | proxypath: null, 48 | proxyOptions: null, 49 | lessOptions: null 50 | }); 51 | 52 | // normalize strings to arrays for "resources" options 53 | ["appresources", "resources", "testresources"].forEach(function(optionName) { 54 | const option = options[optionName]; 55 | if (typeof option === "string") { 56 | options[optionName] = [option]; 57 | } 58 | }); 59 | 60 | const target = this.target; 61 | const args = this.args; 62 | 63 | // Make sure the same target is configured for the 'connect' task 64 | this.requiresConfig(["connect", this.target]); 65 | 66 | // save original middleware object before overwriting it 67 | const vOriginalMiddleware = 68 | grunt.config(["connect", target, "options", "middleware"]) || 69 | grunt.config(["connect", "options", "middleware"]); 70 | 71 | // Adopt connect middleware 72 | grunt.config(["connect", target, "options", "middleware"], function(connect, connectOptions, middlewares) { 73 | middlewares = []; // clear existing middlewares 74 | 75 | // get connect app instance 76 | const app = connect(); 77 | 78 | // adds the middleware (with optional context url) 79 | function mountMiddleware(middleware, context) { 80 | if (typeof context === "string") { 81 | middleware = app.use(urljoin("/", options.contextpath, context), middleware); 82 | } 83 | middlewares.push(middleware); 84 | } 85 | 86 | // returns a function that mounts the static middleware using the provided path 87 | function mountStatic(context) { 88 | return function(staticPath) { 89 | mountMiddleware(serveStatic(staticPath, {dotfiles: "allow"}), context); 90 | }; 91 | } 92 | 93 | // handle livereload option including css/less files (reload css if less files got changed) 94 | if (connectOptions.livereload !== false) { 95 | const port = (connectOptions.livereload === true) ? 35729 : connectOptions.livereload; 96 | connectOptions.livereload = false; // prevent grunt-contrib-connect from inserting the livereload script 97 | mountMiddleware(inject({ 98 | snippet: [ 99 | "\n\n", 100 | "\n\n" 104 | ] 105 | })); 106 | } 107 | 108 | // fix serving *.properties files (encoding) 109 | mountMiddleware(openui5.connect.properties()); 110 | 111 | // enable cors when configured and pass in configuration 112 | if (options.cors) { 113 | mountMiddleware(cors(options.cors)); 114 | } 115 | 116 | // mount discovery middleware (for testsuite) 117 | mountMiddleware(openui5.connect.discovery({ 118 | appresources: options.appresources, 119 | resources: options.resources, 120 | testresources: options.testresources 121 | }), "/discovery"); 122 | 123 | // mount all static paths 124 | options.appresources.forEach(mountStatic("/")); 125 | options.resources.forEach(mountStatic("/resources")); 126 | options.testresources.forEach(mountStatic("/test-resources")); 127 | 128 | // compile themes on-the-fly using openui5 less middleware 129 | options.lessOptions = options.lessOptions || {}; 130 | options.lessOptions.rootPaths = options.resources; 131 | mountMiddleware(openui5.connect.less(options.lessOptions), "/resources"); 132 | 133 | // mount a generic proxy 134 | if (options.proxypath) { 135 | mountMiddleware( 136 | openui5.connect.proxy( 137 | typeof options.proxyOptions === "object" ? options.proxyOptions : undefined 138 | ), 139 | options.proxypath 140 | ); 141 | } 142 | 143 | // run original middleware function 144 | if (typeof vOriginalMiddleware === "function") { 145 | middlewares = vOriginalMiddleware.call(this, connect, connectOptions, middlewares); 146 | } 147 | 148 | return middlewares; 149 | }); 150 | 151 | // Run the 'connect' task with the same target and arguments 152 | let task = "connect:" + target; 153 | if (args.length > 0) { 154 | task += ":" + args.join(":"); 155 | } 156 | grunt.task.run(task); 157 | }); 158 | }; 159 | -------------------------------------------------------------------------------- /tasks/preload.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const slash = require("slash"); 5 | const terser = require("terser"); 6 | const pd = require("pretty-data").pd; 7 | const maxmin = require("maxmin"); 8 | 9 | const defaultResourcePatterns = [ 10 | "**/*.js", 11 | "**/*.fragment.html", 12 | "**/*.fragment.json", 13 | "**/*.fragment.xml", 14 | "**/*.view.html", 15 | "**/*.view.json", 16 | "**/*.view.xml", 17 | "**/*.properties" 18 | ]; 19 | 20 | const copyrightCommentsPattern = /copyright|\(c\)|released under|license|\u00a9/i; 21 | const xmlHtmlPrePattern = /<(?:\w+:)?pre>/; 22 | 23 | function createJSPreload(preloadObject) { 24 | return "sap.ui.require.preload(" + 25 | JSON.stringify(preloadObject.modules, null, "\t") + ", \"" + preloadObject.name + "\");"; 26 | } 27 | function createLegacyJSPreload(preloadObject) { 28 | return "jQuery.sap.registerPreloadedModules(" + JSON.stringify(preloadObject, null, "\t") + ");"; 29 | } 30 | function createLegacyJSONPreload(preloadObject) { 31 | return JSON.stringify(preloadObject, null, "\t"); 32 | } 33 | 34 | module.exports = function(grunt) { 35 | grunt.registerMultiTask("openui5_preload", "Create OpenUI5 preload files", function() { 36 | const done = this.async(); 37 | preloadTask.apply(this).then(done, done); 38 | }); 39 | 40 | async function preloadTask() { 41 | // Merge task-specific and/or target-specific options with these defaults. 42 | const options = this.options({ 43 | resources: [], 44 | dest: null, 45 | compress: true, 46 | compatVersion: "edge" 47 | }); 48 | 49 | const resourceMap = {}; 50 | 51 | // normalize string/object to array 52 | if ( 53 | typeof options.resources === "string" || 54 | (typeof options.resources === "object" && !(options.resources instanceof Array)) 55 | ) { 56 | options.resources = [options.resources]; 57 | } 58 | 59 | if (options.resources.length === 0) { 60 | grunt.fail.warn("\"resources\" option is not specified!"); 61 | return; 62 | } 63 | 64 | grunt.verbose.subhead("Collecting resources"); 65 | 66 | // process resources array 67 | options.resources.forEach(function(resource) { 68 | // transform string shorthand to object 69 | if (typeof resource === "string") { 70 | resource = { 71 | cwd: resource 72 | }; 73 | } 74 | 75 | if (typeof resource.prefix !== "string") { 76 | resource.prefix = ""; 77 | } 78 | 79 | resource.src = resource.src || defaultResourcePatterns; 80 | 81 | grunt.verbose.writeflags(resource, "resource"); 82 | 83 | grunt.file.expand({ 84 | cwd: resource.cwd, 85 | dot: true, 86 | filter: "isFile" 87 | }, resource.src).forEach(function(file) { 88 | let localFile = file; 89 | if (resource.prefix) { 90 | localFile = slash(path.join(resource.prefix, file)); 91 | } 92 | const fullPath = path.join(resource.cwd, file); 93 | grunt.verbose.write("Collecting " + localFile + " (" + fullPath + ")...").ok(); 94 | resourceMap[localFile] = { 95 | fullPath: fullPath, 96 | prefix: resource.prefix 97 | }; 98 | }); 99 | }); 100 | 101 | const resourceFiles = Object.keys(resourceMap); 102 | 103 | if (resourceFiles.length === 0) { 104 | grunt.fail.warn("No files found. Check your \"resources\" option!"); 105 | return; 106 | } 107 | 108 | const preloadData = this.data; 109 | if (!preloadData["components"] && !preloadData["libraries"]) { 110 | grunt.fail.warn("No preload type specified. " + 111 | "Please provide \"components\" and/or \"libraries\" in task target object!"); 112 | return; 113 | } 114 | 115 | const preloadTypes = ["components", "libraries"]; 116 | for (const preloadType of preloadTypes) { 117 | let iMajor; let iMinor; let preloadInfo; let preloadOptions; 118 | preloadOptions = preloadData[preloadType]; 119 | if (!preloadOptions) { 120 | continue; 121 | } 122 | 123 | if (options.compatVersion !== "edge") { 124 | const aVersionMatch = options.compatVersion.match(/^([0-9]+)\.([0-9]+)$/); 125 | if (!aVersionMatch) { 126 | grunt.fail.warn("'" + options.compatVersion + "' is not a valid value for option compatVersion!"); 127 | continue; 128 | } 129 | iMajor = parseInt(aVersionMatch[1], 10); 130 | iMinor = parseInt(aVersionMatch[2], 10); 131 | } 132 | 133 | if (preloadType === "libraries") { 134 | preloadInfo = { 135 | moduleName: "library-preload", 136 | ext: ".js", 137 | indicatorFile: "library.js" 138 | }; 139 | 140 | if (options.compatVersion === "edge" || (iMajor === 1 && iMinor >= 54) || iMajor > 1) { 141 | // Build library-preload as .js file 142 | preloadInfo.createContent = createJSPreload; 143 | } else if (iMajor === 1 && iMinor >= 40 && iMinor < 54) { 144 | // Build library-preload as .js file 145 | preloadInfo.createContent = createLegacyJSPreload; 146 | } else { 147 | // Build as .json file (legacy, needed because UI5 < 1.40 only loads the .json files) 148 | preloadInfo.ext = ".json"; 149 | preloadInfo.processModuleName = function(moduleName) { 150 | return moduleName.replace(/\//g, "."); 151 | }; 152 | preloadInfo.createContent = createLegacyJSONPreload; 153 | } 154 | } else { 155 | preloadInfo = { 156 | moduleName: "Component-preload", 157 | ext: ".js", 158 | indicatorFile: "Component.js" 159 | }; 160 | 161 | if (options.compatVersion === "edge" || (iMajor === 1 && iMinor >= 54) || iMajor > 1) { 162 | preloadInfo.createContent = createJSPreload; 163 | } else { 164 | preloadInfo.createContent = createLegacyJSPreload; 165 | } 166 | } 167 | 168 | 169 | if (preloadOptions === true) { 170 | preloadOptions = "**"; 171 | } 172 | if (typeof preloadOptions === "string") { 173 | const pattern = preloadOptions; 174 | preloadOptions = {}; 175 | preloadOptions[pattern] = {}; 176 | } 177 | 178 | const preloadOptionKeys = Object.keys(preloadOptions); 179 | 180 | if (preloadOptionKeys.length === 0) { 181 | grunt.log.writeflags(preloadOptions, "preloadOptions"); 182 | grunt.fail.warn("No valid options provided for \"" + preloadType + "\" preload!"); 183 | continue; 184 | } 185 | 186 | for (const preloadPattern of preloadOptionKeys) { 187 | const preloadOption = preloadOptions[preloadPattern]; 188 | const preloadFiles = grunt.file.match(preloadPattern + "/" + preloadInfo.indicatorFile, resourceFiles); 189 | 190 | if (preloadFiles.length < 1) { 191 | grunt.fail.warn("No \"" + preloadInfo.indicatorFile + 192 | "\" found for pattern \"" + preloadPattern + "\"!"); 193 | continue; 194 | } 195 | 196 | for (const preloadFile of preloadFiles) { 197 | const preloadDir = path.dirname(preloadFile); 198 | const preloadModuleName = preloadDir + "/" + preloadInfo.moduleName; 199 | 200 | grunt.verbose.subhead("Creating preload module for " + preloadFile); 201 | 202 | const preloadObject = { 203 | version: "2.0", 204 | name: preloadModuleName, 205 | modules: {} 206 | }; 207 | 208 | if (typeof preloadInfo.processModuleName === "function") { 209 | preloadObject.name = preloadInfo.processModuleName(preloadModuleName); 210 | } else { 211 | preloadObject.name = preloadModuleName; 212 | } 213 | 214 | let preloadPatterns = preloadOption.src ? preloadOption.src : [preloadDir + "/**"]; 215 | if (typeof preloadPatterns === "string") { 216 | preloadPatterns = [preloadPatterns]; 217 | } 218 | 219 | // Always exclude the corresponding preload file (Component-preload.js / library-preload.json) 220 | // Otherwise it might get included every time the build runs if src / dest are the same dir 221 | preloadPatterns.push("!" + preloadDir + "/" + preloadInfo.moduleName + preloadInfo.ext); 222 | 223 | const preloadFiles = grunt.file.match(preloadPatterns, resourceFiles); 224 | if (preloadFiles.length === 0) { 225 | const patternsString = 226 | (typeof preloadPatterns === "string") ? preloadPatterns : preloadPatterns.join("\", \""); 227 | grunt.fail.warn("No files found for pattern(s): \"" + patternsString + "\"!"); 228 | continue; 229 | } 230 | 231 | let iPreloadOriginalSize = 0; let iPreloadCompressedSize = 0; 232 | 233 | for (const preloadFile of preloadFiles) { 234 | const fileName = resourceMap[preloadFile].fullPath; 235 | let fileContent = grunt.file.read(fileName); 236 | const fileExtension = path.extname(fileName); 237 | 238 | let iOriginalSize; let iCompressedSize; 239 | 240 | if (options.compress) { 241 | iOriginalSize = fileContent.length; 242 | iPreloadOriginalSize += iOriginalSize; 243 | 244 | // Convert default compression to empty configuration object 245 | if (options.compress === true) { 246 | options.compress = {}; 247 | } 248 | 249 | // Make sure to have an object 250 | options.compress.terser = options.compress.terser || options.compress.uglifyjs || {}; 251 | 252 | // Set default "comments" option if not given already 253 | options.compress.terser.output = options.compress.terser.output || {}; 254 | if (!Object.prototype.hasOwnProperty.call(options.compress.terser.output, "comments")) { 255 | options.compress.terser.output.comments = copyrightCommentsPattern; 256 | } 257 | 258 | try { 259 | switch (fileExtension) { 260 | case ".js": 261 | // Javascript files are processed by Uglify 262 | fileContent = (await terser.minify(fileContent, options.compress.terser)).code; 263 | break; 264 | case ".json": 265 | // JSON is parsed and written to string again to remove unwanted white space 266 | fileContent = JSON.stringify(JSON.parse(fileContent)); 267 | break; 268 | case ".xml": 269 | // For XML we use the pretty data 270 | 271 | // Do not minify if XML(View) contains an <*:pre> tag because whitespace of 272 | // HTML
 should be preserved (should only happen rarely)
273 | 									if (!xmlHtmlPrePattern.test(fileContent)) {
274 | 										fileContent = pd.xmlmin(fileContent, false);
275 | 									}
276 | 
277 | 									break;
278 | 								}
279 | 							} catch (e) {
280 | 								grunt.log.error("Failed to compress " + fileName +
281 | 									". This might be due to a syntax error in the file.");
282 | 								grunt.fail.warn(e);
283 | 							}
284 | 
285 | 							iCompressedSize = fileContent.length;
286 | 							iPreloadCompressedSize += iCompressedSize;
287 | 						}
288 | 
289 | 						if (grunt.option("verbose")) {
290 | 							let log = "Adding " + preloadFile;
291 | 							if (iOriginalSize && iCompressedSize && iOriginalSize !== iCompressedSize) {
292 | 								log += " (" + maxmin({length: iOriginalSize}, {length: iCompressedSize}) + ")";
293 | 							}
294 | 							grunt.verbose.writeln(log);
295 | 						}
296 | 
297 | 						preloadObject.modules[preloadFile] = fileContent;
298 | 					}
299 | 
300 | 					const content = preloadInfo.createContent(preloadObject);
301 | 
302 | 					let destPath = options.dest;
303 | 					const preloadResourceInfo = resourceMap[preloadFile];
304 | 					if (preloadModuleName.indexOf(preloadResourceInfo.prefix) === 0) {
305 | 						destPath = path.join(destPath, preloadModuleName.substr(preloadResourceInfo.prefix.length));
306 | 					} else {
307 | 						destPath = path.join(destPath, preloadModuleName);
308 | 					}
309 | 					destPath += preloadInfo.ext;
310 | 
311 | 					grunt.file.write(destPath, content);
312 | 					let log = "File " + destPath + " created with " +
313 | 						Object.keys(preloadObject.modules).length + " files";
314 | 					if (
315 | 						iPreloadOriginalSize && iPreloadCompressedSize &&
316 | 						iPreloadOriginalSize !== iPreloadCompressedSize
317 | 					) {
318 | 						log += " (" + maxmin({length: iPreloadOriginalSize}, {length: iPreloadCompressedSize}) + ")";
319 | 					}
320 | 					grunt.log.writeln(log);
321 | 				}
322 | 			}
323 | 		}
324 | 	}
325 | };
326 | 


--------------------------------------------------------------------------------
/tasks/theme.js:
--------------------------------------------------------------------------------
 1 | "use strict";
 2 | 
 3 | const path = require("path");
 4 | const async = require("async");
 5 | const less = require("less-openui5");
 6 | 
 7 | module.exports = function(grunt) {
 8 | 	grunt.registerMultiTask("openui5_theme", "OpenUI5 Theme Build", function() {
 9 | 		// Merge task-specific and/or target-specific options with these defaults.
10 | 		const options = this.options({
11 | 			rootPaths: [],
12 | 			rtl: true,
13 | 			parser: {},
14 | 			compiler: {}
15 | 		});
16 | 
17 | 		const builder = new less.Builder();
18 | 
19 | 		// TODO check no file
20 | 
21 | 		// Iterate over all specified file groups.
22 | 		async.eachSeries(this.files, function(fileObj, nextFileObj) {
23 | 			const files = fileObj.src.filter(function(filepath) {
24 | 				// Warn on and remove invalid source files (if nonull was set).
25 | 				if (!grunt.file.exists(filepath)) {
26 | 					grunt.log.warn("Source file \"" + filepath + "\" not found.");
27 | 					return false;
28 | 				} else {
29 | 					return true;
30 | 				}
31 | 			});
32 | 
33 | 			// TODO check no file
34 | 
35 | 			async.concatSeries(files, function(file, next) {
36 | 				if (options.rootPaths) {
37 | 					// Map rootpaths and get lessInputPath
38 | 					options.rootPaths.forEach(function(path) {
39 | 						if (file.indexOf(path) !== -1) {
40 | 							file = file.substring(path.length);
41 | 						}
42 | 					});
43 | 				}
44 | 
45 | 				builder.build(grunt.util._.extend({}, options, {
46 | 					lessInputPath: file
47 | 				})).then(function(result) {
48 | 					const destDir = path.dirname(fileObj.dest);
49 | 
50 | 					const cssDestFile = destDir + "/library.css";
51 | 					grunt.file.write(cssDestFile, result.css);
52 | 					grunt.log.writeln("File " + cssDestFile + " created.");
53 | 
54 | 					const rtlCssDestFile = destDir + "/library-RTL.css";
55 | 					grunt.file.write(rtlCssDestFile, result.cssRtl);
56 | 					grunt.log.writeln("File " + rtlCssDestFile + " created.");
57 | 
58 | 					const parametersDestFile = destDir + "/library-parameters.json";
59 | 					const parametersFileContent = JSON.stringify(
60 | 						result.variables, null, options.compiler.compress ? 0 : 4
61 | 					);
62 | 					grunt.file.write(parametersDestFile, parametersFileContent);
63 | 					grunt.log.writeln("File " + parametersDestFile + " created.");
64 | 
65 | 					process.nextTick(next);
66 | 				}, function(err) {
67 | 					nextFileObj(err);
68 | 				});
69 | 			}, function() {
70 | 				nextFileObj();
71 | 			});
72 | 		}, this.async());
73 | 	});
74 | };
75 | 


--------------------------------------------------------------------------------
/test/asserts/fileContent.js:
--------------------------------------------------------------------------------
 1 | const assert = require("assert");
 2 | const grunt = require("grunt");
 3 | 
 4 | exports.equal = function(oOptions) {
 5 | 	const oReadOptions = {
 6 | 		encoding: "utf8"
 7 | 	};
 8 | 
 9 | 	const sActualFileContent = grunt.file.read(oOptions.sActualFileSource, oReadOptions)
10 | 		.replace(/\r\n/gm, "\n") // replace \r\n with \n to be consistent everywhere
11 | 		.replace(/\\r\\n/gm, "\\n") // replace \\r\\n with \\n to be consistent everywhere
12 | 		.replace(/\n$/, ""); // remove the last LF;
13 | 	const sExpectedFileContent = grunt.file.read(oOptions.sExpectedFileSource, oReadOptions)
14 | 		.replace(/\r\n/gm, "\n") // replace \r\n with \n to be consistent everywhere
15 | 		.replace(/\\r\\n/gm, "\\n") // replace \\r\\n with \\n to be consistent everywhere
16 | 		.replace(/\n$/, ""); // remove the last LF
17 | 
18 | 	assert.equal(sActualFileContent, sExpectedFileContent, oOptions.sMessage);
19 | };
20 | 


--------------------------------------------------------------------------------
/test/connect/fixtures/anotherLib/res/controlOfAnotherLib.js:
--------------------------------------------------------------------------------
 1 | // Some
 2 | //
 3 | // Long
 4 | // Multiline
 5 | // Comment
 6 | //
 7 | // Containing
 8 | //
 9 | // Some
10 | // Information
11 | // Like
12 | // This:
13 | // Pony!
14 | 


--------------------------------------------------------------------------------
/test/connect/fixtures/anotherLib/testres/someTest.js:
--------------------------------------------------------------------------------
 1 | // Some
 2 | //
 3 | // Long
 4 | // Multiline
 5 | // Comment
 6 | //
 7 | // Containing
 8 | //
 9 | // Some
10 | // Information
11 | // Like
12 | // This:
13 | // Pony!
14 | 


--------------------------------------------------------------------------------
/test/connect/fixtures/app/app.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	
 6 | 
 7 | 
 8 | 
 9 | 
10 | 


--------------------------------------------------------------------------------
/test/connect/fixtures/foo.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	
 6 | 
 7 | 
 8 | 
 9 | 
10 | 


--------------------------------------------------------------------------------
/test/connect/fixtures/someLib/resources/someHtml.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	
 6 | 
 7 | 
 8 | 
 9 | 
10 | 


--------------------------------------------------------------------------------
/test/connect/fixtures/someLib/test-resources/SomeTest.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 	
 5 | 	
 6 | 
 7 | 
 8 | 
 9 | 
10 | 


--------------------------------------------------------------------------------
/test/connect_test.js:
--------------------------------------------------------------------------------
  1 | /* eslint-env mocha */
  2 | "use strict";
  3 | 
  4 | const assert = require("assert");
  5 | const http = require("http");
  6 | const async = require("async");
  7 | 
  8 | function getHttpStatus(sUrl, fnCallback) {
  9 | 	const oOptions = {
 10 | 		hostname: "localhost",
 11 | 		port: 8080,
 12 | 		path: sUrl,
 13 | 		method: "GET"
 14 | 	};
 15 | 
 16 | 	const oRequest = http.request(oOptions, function(oResponse) {
 17 | 		// If you do not add this the server will hang after 5 requests
 18 | 		oResponse.on("data", function() {/* do nothing */});
 19 | 
 20 | 		fnCallback(oResponse.statusCode);
 21 | 	});
 22 | 
 23 | 
 24 | 	oRequest.end();
 25 | }
 26 | 
 27 | function fnStatusOkTestCase(sUrl, fnDone) {
 28 | 	getHttpStatus(sUrl, function(statusCode) {
 29 | 		assert.equal(statusCode, 200, "Did return a 200 for url: " + sUrl + " returned http-status: " + statusCode);
 30 | 		fnDone();
 31 | 	});
 32 | }
 33 | 
 34 | function fnStatusNotFoundTestCase(sUrl, fnDone) {
 35 | 	getHttpStatus(sUrl, function(iStatusCode) {
 36 | 		assert.equal(iStatusCode, 404, "Did return a 404 for url: " + sUrl + " returned http-status: " + iStatusCode);
 37 | 		fnDone();
 38 | 	});
 39 | }
 40 | 
 41 | describe("openui5 connect should return status 200 ok for", function() {
 42 | 	it("an existing test-resource file of another library", function(fnDone) {
 43 | 		fnStatusOkTestCase("/mycontext/test-resources/SomeTest.html", fnDone);
 44 | 	});
 45 | 
 46 | 	it("a file in a different folter in the app resources", function(fnDone) {
 47 | 		fnStatusOkTestCase("/mycontext/foo.html", fnDone);
 48 | 	});
 49 | 
 50 | 	it("an existing resource file", function(fnDone) {
 51 | 		fnStatusOkTestCase("/mycontext/resources/controlOfAnotherLib.js", fnDone);
 52 | 	});
 53 | 
 54 | 	it("an existing test-resource file", function(fnDone) {
 55 | 		fnStatusOkTestCase("/mycontext/test-resources/someTest.js", fnDone);
 56 | 	});
 57 | 
 58 | 	it("an existing resource file of another library", function(fnDone) {
 59 | 		fnStatusOkTestCase("/mycontext/resources/someHtml.html", fnDone);
 60 | 	});
 61 | 
 62 | 	it("a file in the app resources", function(fnDone) {
 63 | 		fnStatusOkTestCase("/mycontext/app.html", fnDone);
 64 | 	});
 65 | 
 66 | 	it("a file from custom connect middleware", function(fnDone) {
 67 | 		fnStatusOkTestCase("/foo", fnDone);
 68 | 	});
 69 | });
 70 | 
 71 | describe("openui5 connect should return status 404 not found for", function() {
 72 | 	it("a non existing resource file", function(fnDone) {
 73 | 		fnStatusNotFoundTestCase("/mycontext/resources/hundekuchen.js", fnDone);
 74 | 	});
 75 | 
 76 | 	it("a existing resource file without the context path", function(fnDone) {
 77 | 		fnStatusNotFoundTestCase("/resources/someHtml.html", fnDone);
 78 | 	});
 79 | 
 80 | 	it("a file in the app resources", function(fnDone) {
 81 | 		fnStatusNotFoundTestCase("/resources/someHtml.html", fnDone);
 82 | 	});
 83 | });
 84 | 
 85 | function connectTestcase(fnDone, sUrl) {
 86 | 	let sExpectedData = "";
 87 | 	let sActualData = "";
 88 | 	let iExpectedStatusCode;
 89 | 	let iActualStatusCode;
 90 | 	const aCalls = [];
 91 | 
 92 | 	aCalls.push(function(fnCallback) {
 93 | 		http.get("http://localhost:9000/" + sUrl, function(oResponse) {
 94 | 			oResponse.on("data", function(oData) {
 95 | 				sExpectedData += oData;
 96 | 			});
 97 | 			iExpectedStatusCode = oResponse.statusCode;
 98 | 			oResponse.on("end", fnCallback);
 99 | 		});
100 | 	});
101 | 
102 | 	aCalls.push(function(fnCallback) {
103 | 		http.get("http://localhost:8080/mycontext/proxy/http/localhost:9000/" + sUrl, function(oResponse) {
104 | 			oResponse.on("data", function(oData) {
105 | 				sActualData += oData;
106 | 			});
107 | 			iActualStatusCode = oResponse.statusCode;
108 | 			oResponse.on("end", fnCallback);
109 | 		});
110 | 	});
111 | 
112 | 	async.parallel(aCalls, function() {
113 | 		assert.equal(sExpectedData, sActualData);
114 | 		assert.equal(iExpectedStatusCode, iActualStatusCode);
115 | 		fnDone();
116 | 	});
117 | }
118 | 
119 | describe("openui5 connect should proxy requests", function() {
120 | 	it("proxies a request to an existing resource", function(done) {
121 | 		connectTestcase(done, "mycontext/resources/someHtml.html");
122 | 	});
123 | 
124 | 	it("proxies a request to an non existing resource", function(done) {
125 | 		connectTestcase(done, "mycontext/resources/hundekuchen.js");
126 | 	});
127 | 
128 | 	it("proxies a request to an non existing resource not in the context", function(done) {
129 | 		connectTestcase(done, "any/other/url.js");
130 | 	});
131 | });
132 | 


--------------------------------------------------------------------------------
/test/preload/expected/component_compat_140/my/app/Component-preload.js:
--------------------------------------------------------------------------------
1 | jQuery.sap.registerPreloadedModules({
2 | 	"version": "2.0",
3 | 	"name": "my/app/Component-preload",
4 | 	"modules": {
5 | 		"my/app/Component.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
6 | 		"my/app/view/my.view.xml": "XML\n",
7 | 		"my/app/view/myHtmlPre.view.xml": "XML\n\n   "
8 | 	}
9 | });


--------------------------------------------------------------------------------
/test/preload/expected/component_compat_154/my/app/Component-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/app/Component.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
3 | 	"my/app/view/my.view.xml": "XML\n",
4 | 	"my/app/view/myHtmlPre.view.xml": "XML\n\n   "
5 | }, "my/app/Component-preload");


--------------------------------------------------------------------------------
/test/preload/expected/component_default_options/my/app/Component-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/app/Component.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
3 | 	"my/app/view/my.view.xml": "XML\n",
4 | 	"my/app/view/myHtmlPre.view.xml": "XML\n\n   "
5 | }, "my/app/Component-preload");


--------------------------------------------------------------------------------
/test/preload/expected/component_no_compress/my/app/Component-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/app/Component.js": "/* © */\n'use strict';\n\n/**\n* This is a copyright comment\n*/\n\n/* (c) */\n\n/* released under */\n/* normal comment */\n/* license */\n\n\nconsole.log('myJS');\n\n/**\n * This is a little comment\n */\nfunction myFunction(longVariableName, longerVariableName) {\n\treturn longVariableName + longerVariableName;\n}\n",
3 | 	"my/app/view/my.view.xml": "XML\n",
4 | 	"my/app/view/myHtmlPre.view.xml": "XML\n\n   "
5 | }, "my/app/Component-preload");
6 | 


--------------------------------------------------------------------------------
/test/preload/expected/component_resource_prefix/Component-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/app/Component.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
3 | 	"my/app/view/my.view.xml": "XML\n",
4 | 	"my/app/view/myHtmlPre.view.xml": "XML\n\n   "
5 | }, "my/app/Component-preload");


--------------------------------------------------------------------------------
/test/preload/expected/library_compat_138/my/ui/lib/library-preload.json:
--------------------------------------------------------------------------------
 1 | {
 2 | 	"version": "2.0",
 3 | 	"name": "my.ui.lib.library-preload",
 4 | 	"modules": {
 5 | 		"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
 6 | 		"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
 7 | 		"my/ui/lib/my.view.xml": "XML\n",
 8 | 		"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
 9 | 		"my/ui/lib/foo.properties": "FOO=BAR\n"
10 | 	}
11 | }


--------------------------------------------------------------------------------
/test/preload/expected/library_compat_140/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
 1 | jQuery.sap.registerPreloadedModules({
 2 | 	"version": "2.0",
 3 | 	"name": "my/ui/lib/library-preload",
 4 | 	"modules": {
 5 | 		"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
 6 | 		"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
 7 | 		"my/ui/lib/my.view.xml": "XML\n",
 8 | 		"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
 9 | 		"my/ui/lib/foo.properties": "FOO=BAR\n"
10 | 	}
11 | });


--------------------------------------------------------------------------------
/test/preload/expected/library_compat_154/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
3 | 	"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");


--------------------------------------------------------------------------------
/test/preload/expected/library_custom_terser_params/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
3 | 	"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(longVariableName,longerVariableName){return longVariableName+longerVariableName+\"\\u518d\\u6309\\u4e00\\u6b21\\u9000\\u51fa\\u4f19\\u62fc\"}console.log(\"myJS\");",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");


--------------------------------------------------------------------------------
/test/preload/expected/library_custom_uglify_params/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
3 | 	"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(longVariableName,longerVariableName){return longVariableName+longerVariableName+\"\\u518d\\u6309\\u4e00\\u6b21\\u9000\\u51fa\\u4f19\\u62fc\"}console.log(\"myJS\");",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");


--------------------------------------------------------------------------------
/test/preload/expected/library_default_options/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
3 | 	"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");


--------------------------------------------------------------------------------
/test/preload/expected/library_no_compress/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\");\njQuery.sap.declare(\"my.ui.lib.library\");\n\nsap.ui.getCore().initLibrary({\n\tname : \"my.ui.lib\",\n\tversion: \"0.0.0\",\n\tdependencies : [\"sap.ui.core\"]\n});\n",
3 | 	"my/ui/lib/myJS.js": "/* © */\n'use strict';\n\n/**\n* This is a copyright comment\n*/\n\n/* (c) */\n\n/* released under */\n/* normal comment */\n/* license */\n\n\nconsole.log('myJS');\n\n/**\n * This is a little comment\n */\nfunction myFunction(longVariableName, longerVariableName) {\n\treturn longVariableName + longerVariableName;\n}\n",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");
8 | 


--------------------------------------------------------------------------------
/test/preload/expected/library_resource_prefix/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
3 | 	"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");


--------------------------------------------------------------------------------
/test/preload/fixtures/app-same-dest/my/app/Component-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/app/Component.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
3 | 	"my/app/view/my.view.xml": "XML\n",
4 | 	"my/app/view/myHtmlPre.view.xml": "XML\n\n   "
5 | }, "my/app/Component-preload");


--------------------------------------------------------------------------------
/test/preload/fixtures/app-same-dest/my/app/Component.js:
--------------------------------------------------------------------------------
 1 | /* © */
 2 | 'use strict';
 3 | 
 4 | /**
 5 | * This is a copyright comment
 6 | */
 7 | 
 8 | /* (c) */
 9 | 
10 | /* released under */
11 | /* normal comment */
12 | /* license */
13 | 
14 | 
15 | console.log('myJS');
16 | 
17 | /**
18 |  * This is a little comment
19 |  */
20 | function myFunction(longVariableName, longerVariableName) {
21 | 	return longVariableName + longerVariableName;
22 | }
23 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/app-same-dest/my/app/view/my.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/app-same-dest/my/app/view/myHtmlPre.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 
3 |    


--------------------------------------------------------------------------------
/test/preload/fixtures/app/my/app/Component.js:
--------------------------------------------------------------------------------
 1 | /* © */
 2 | 'use strict';
 3 | 
 4 | /**
 5 | * This is a copyright comment
 6 | */
 7 | 
 8 | /* (c) */
 9 | 
10 | /* released under */
11 | /* normal comment */
12 | /* license */
13 | 
14 | 
15 | console.log('myJS');
16 | 
17 | /**
18 |  * This is a little comment
19 |  */
20 | function myFunction(longVariableName, longerVariableName) {
21 | 	return longVariableName + longerVariableName;
22 | }
23 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/app/my/app/view/my.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/app/my/app/view/myHtmlPre.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 
3 |    


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-terser-params/my/ui/lib/foo.properties:
--------------------------------------------------------------------------------
1 | FOO=BAR
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-terser-params/my/ui/lib/library.js:
--------------------------------------------------------------------------------
1 | jQuery.sap.require("sap.ui.core.library");
2 | jQuery.sap.declare("my.ui.lib.library");
3 | 
4 | sap.ui.getCore().initLibrary({
5 | 	name : "my.ui.lib",
6 | 	version: "0.0.0",
7 | 	dependencies : ["sap.ui.core"]
8 | });
9 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-terser-params/my/ui/lib/my.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-terser-params/my/ui/lib/myHtmlPre.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 
3 |    


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-terser-params/my/ui/lib/myJS.js:
--------------------------------------------------------------------------------
 1 | /* © */
 2 | 'use strict';
 3 | 
 4 | /**
 5 | * This is a copyright comment
 6 | */
 7 | 
 8 | /* (c) */
 9 | 
10 | /* released under */
11 | /* normal comment */
12 | /* license */
13 | 
14 | 
15 | console.log('myJS');
16 | 
17 | /**
18 |  * This is a little comment
19 |  */
20 | function myFunction(longVariableName, longerVariableName) {
21 |     var sample = '\u518d\u6309\u4e00\u6b21\u9000\u51fa\u4f19\u62fc';
22 | 	return longVariableName + longerVariableName + sample;
23 | }
24 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-terser-params/my/ui/lib/myJSON.json:
--------------------------------------------------------------------------------
1 | {
2 | 	"my": "json"
3 | }
4 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-uglify-params/my/ui/lib/foo.properties:
--------------------------------------------------------------------------------
1 | FOO=BAR
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-uglify-params/my/ui/lib/library.js:
--------------------------------------------------------------------------------
1 | jQuery.sap.require("sap.ui.core.library");
2 | jQuery.sap.declare("my.ui.lib.library");
3 | 
4 | sap.ui.getCore().initLibrary({
5 | 	name : "my.ui.lib",
6 | 	version: "0.0.0",
7 | 	dependencies : ["sap.ui.core"]
8 | });
9 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-uglify-params/my/ui/lib/my.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-uglify-params/my/ui/lib/myHtmlPre.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 
3 |    


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-uglify-params/my/ui/lib/myJS.js:
--------------------------------------------------------------------------------
 1 | /* © */
 2 | 'use strict';
 3 | 
 4 | /**
 5 | * This is a copyright comment
 6 | */
 7 | 
 8 | /* (c) */
 9 | 
10 | /* released under */
11 | /* normal comment */
12 | /* license */
13 | 
14 | 
15 | console.log('myJS');
16 | 
17 | /**
18 |  * This is a little comment
19 |  */
20 | function myFunction(longVariableName, longerVariableName) {
21 |     var sample = '\u518d\u6309\u4e00\u6b21\u9000\u51fa\u4f19\u62fc';
22 | 	return longVariableName + longerVariableName + sample;
23 | }
24 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-custom-uglify-params/my/ui/lib/myJSON.json:
--------------------------------------------------------------------------------
1 | {
2 | 	"my": "json"
3 | }
4 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/foo.properties:
--------------------------------------------------------------------------------
1 | FOO=BAR
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/library-preload.js:
--------------------------------------------------------------------------------
1 | sap.ui.require.preload({
2 | 	"my/ui/lib/library.js": "jQuery.sap.require(\"sap.ui.core.library\"),jQuery.sap.declare(\"my.ui.lib.library\"),sap.ui.getCore().initLibrary({name:\"my.ui.lib\",version:\"0.0.0\",dependencies:[\"sap.ui.core\"]});",
3 | 	"my/ui/lib/myJS.js": "/* © */\n\"use strict\";\n/**\n* This is a copyright comment\n*/\n/* (c) */\n/* released under */\n/* license */function myFunction(n,o){return n+o}console.log(\"myJS\");",
4 | 	"my/ui/lib/my.view.xml": "XML\n",
5 | 	"my/ui/lib/myHtmlPre.view.xml": "XML\n\n   ",
6 | 	"my/ui/lib/foo.properties": "FOO=BAR\n"
7 | }, "my/ui/lib/library-preload");


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/library.js:
--------------------------------------------------------------------------------
1 | jQuery.sap.require("sap.ui.core.library");
2 | jQuery.sap.declare("my.ui.lib.library");
3 | 
4 | sap.ui.getCore().initLibrary({
5 | 	name : "my.ui.lib",
6 | 	version: "0.0.0",
7 | 	dependencies : ["sap.ui.core"]
8 | });
9 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/my.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/myHtmlPre.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 
3 |    


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/myJS.js:
--------------------------------------------------------------------------------
 1 | /* © */
 2 | 'use strict';
 3 | 
 4 | /**
 5 | * This is a copyright comment
 6 | */
 7 | 
 8 | /* (c) */
 9 | 
10 | /* released under */
11 | /* normal comment */
12 | /* license */
13 | 
14 | 
15 | console.log('myJS');
16 | 
17 | /**
18 |  * This is a little comment
19 |  */
20 | function myFunction(longVariableName, longerVariableName) {
21 | 	return longVariableName + longerVariableName;
22 | }
23 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library-same-dest/my/ui/lib/myJSON.json:
--------------------------------------------------------------------------------
1 | {
2 | 	"my": "json"
3 | }
4 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library/my/ui/lib/foo.properties:
--------------------------------------------------------------------------------
1 | FOO=BAR
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library/my/ui/lib/library.js:
--------------------------------------------------------------------------------
1 | jQuery.sap.require("sap.ui.core.library");
2 | jQuery.sap.declare("my.ui.lib.library");
3 | 
4 | sap.ui.getCore().initLibrary({
5 | 	name : "my.ui.lib",
6 | 	version: "0.0.0",
7 | 	dependencies : ["sap.ui.core"]
8 | });
9 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library/my/ui/lib/my.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library/my/ui/lib/myHtmlPre.view.xml:
--------------------------------------------------------------------------------
1 | XML
2 | 
3 |    


--------------------------------------------------------------------------------
/test/preload/fixtures/library/my/ui/lib/myJS.js:
--------------------------------------------------------------------------------
 1 | /* © */
 2 | 'use strict';
 3 | 
 4 | /**
 5 | * This is a copyright comment
 6 | */
 7 | 
 8 | /* (c) */
 9 | 
10 | /* released under */
11 | /* normal comment */
12 | /* license */
13 | 
14 | 
15 | console.log('myJS');
16 | 
17 | /**
18 |  * This is a little comment
19 |  */
20 | function myFunction(longVariableName, longerVariableName) {
21 | 	return longVariableName + longerVariableName;
22 | }
23 | 


--------------------------------------------------------------------------------
/test/preload/fixtures/library/my/ui/lib/myJSON.json:
--------------------------------------------------------------------------------
1 | {
2 | 	"my": "json"
3 | }
4 | 


--------------------------------------------------------------------------------
/test/preload_test.js:
--------------------------------------------------------------------------------
  1 | /* eslint-env mocha */
  2 | "use strict";
  3 | 
  4 | const fileContent = require("./asserts/fileContent");
  5 | 
  6 | describe("openui5_preload", function() {
  7 | 	describe("library", function() {
  8 | 		it("default_options", function() {
  9 | 			fileContent.equal({
 10 | 				sActualFileSource: "tmp/preload/library_default_options/my/ui/lib/library-preload.js",
 11 | 				sExpectedFileSource: "test/preload/expected/library_default_options/my/ui/lib/library-preload.js",
 12 | 				sMessage: "library preload JS should be correctly created."
 13 | 			});
 14 | 		});
 15 | 
 16 | 		it("compat_138", function() {
 17 | 			fileContent.equal({
 18 | 				sActualFileSource: "tmp/preload/library_compat_138/my/ui/lib/library-preload.json",
 19 | 				sExpectedFileSource: "test/preload/expected/library_compat_138/my/ui/lib/library-preload.json",
 20 | 				sMessage: "library preload JSON should be correctly created."
 21 | 			});
 22 | 		});
 23 | 
 24 | 		it("compat_140", function() {
 25 | 			fileContent.equal({
 26 | 				sActualFileSource: "tmp/preload/library_compat_140/my/ui/lib/library-preload.js",
 27 | 				sExpectedFileSource: "test/preload/expected/library_compat_140/my/ui/lib/library-preload.js",
 28 | 				sMessage: "library preload JS should be correctly created."
 29 | 			});
 30 | 		});
 31 | 
 32 | 		it("compat_154", function() {
 33 | 			fileContent.equal({
 34 | 				sActualFileSource: "tmp/preload/library_compat_154/my/ui/lib/library-preload.js",
 35 | 				sExpectedFileSource: "test/preload/expected/library_compat_154/my/ui/lib/library-preload.js",
 36 | 				sMessage: "library preload JS should be correctly created."
 37 | 			});
 38 | 		});
 39 | 
 40 | 		it("resource_prefix", function() {
 41 | 			fileContent.equal({
 42 | 				sActualFileSource: "tmp/preload/library_resource_prefix/library-preload.js",
 43 | 				sExpectedFileSource: "test/preload/expected/library_resource_prefix/library-preload.js",
 44 | 				sMessage: "library preload JS should be correctly created."
 45 | 			});
 46 | 		});
 47 | 
 48 | 		it("no_compress", function() {
 49 | 			fileContent.equal({
 50 | 				sActualFileSource: "tmp/preload/library_no_compress/my/ui/lib/library-preload.js",
 51 | 				sExpectedFileSource: "test/preload/expected/library_no_compress/my/ui/lib/library-preload.js",
 52 | 				sMessage: "library preload JS should be correctly created."
 53 | 			});
 54 | 		});
 55 | 
 56 | 		it("custom_terser_params", function() {
 57 | 			fileContent.equal({
 58 | 				sActualFileSource: "tmp/preload/library_custom_terser_params/my/ui/lib/library-preload.js",
 59 | 				sExpectedFileSource: "test/preload/expected/library_custom_terser_params/my/ui/lib/library-preload.js",
 60 | 				sMessage: "library preload JS should be correctly created."
 61 | 			});
 62 | 		});
 63 | 
 64 | 		it("custom_uglify_params", function() {
 65 | 			fileContent.equal({
 66 | 				sActualFileSource: "tmp/preload/library_custom_uglify_params/my/ui/lib/library-preload.js",
 67 | 				sExpectedFileSource: "test/preload/expected/library_custom_uglify_params/my/ui/lib/library-preload.js",
 68 | 				sMessage: "library preload JS should be correctly created."
 69 | 			});
 70 | 		});
 71 | 
 72 | 		it("library_same_dest", function() {
 73 | 			fileContent.equal({
 74 | 				sActualFileSource: "test/preload/fixtures/library-same-dest/my/ui/lib/library-preload.js",
 75 | 				sExpectedFileSource: "test/preload/expected/library_default_options/my/ui/lib/library-preload.js",
 76 | 				sMessage: "library preload JS should be correctly created."
 77 | 			});
 78 | 		});
 79 | 	});
 80 | 
 81 | 	describe("component", function() {
 82 | 		it("default_options", function() {
 83 | 			fileContent.equal({
 84 | 				sActualFileSource: "tmp/preload/component_default_options/my/app/Component-preload.js",
 85 | 				sExpectedFileSource: "test/preload/expected/component_default_options/my/app/Component-preload.js",
 86 | 				sMessage: "component preload JS should be correctly created."
 87 | 			});
 88 | 		});
 89 | 
 90 | 		it("compat_140", function() {
 91 | 			fileContent.equal({
 92 | 				sActualFileSource: "tmp/preload/component_compat_140/my/app/Component-preload.js",
 93 | 				sExpectedFileSource: "test/preload/expected/component_compat_140/my/app/Component-preload.js",
 94 | 				sMessage: "component preload JS should be correctly created."
 95 | 			});
 96 | 		});
 97 | 
 98 | 		it("compat_154", function() {
 99 | 			fileContent.equal({
100 | 				sActualFileSource: "tmp/preload/component_compat_154/my/app/Component-preload.js",
101 | 				sExpectedFileSource: "test/preload/expected/component_compat_154/my/app/Component-preload.js",
102 | 				sMessage: "component preload JS should be correctly created."
103 | 			});
104 | 		});
105 | 
106 | 		it("resource_prefix", function() {
107 | 			fileContent.equal({
108 | 				sActualFileSource: "tmp/preload/component_resource_prefix/Component-preload.js",
109 | 				sExpectedFileSource: "test/preload/expected/component_resource_prefix/Component-preload.js",
110 | 				sMessage: "component preload JS should be correctly created."
111 | 			});
112 | 		});
113 | 
114 | 		it("no_compress", function() {
115 | 			fileContent.equal({
116 | 				sActualFileSource: "tmp/preload/component_no_compress/my/app/Component-preload.js",
117 | 				sExpectedFileSource: "test/preload/expected/component_no_compress/my/app/Component-preload.js",
118 | 				sMessage: "component preload JS should be correctly created."
119 | 			});
120 | 		});
121 | 
122 | 		it("component_same_dest", function() {
123 | 			fileContent.equal({
124 | 				sActualFileSource: "test/preload/fixtures/app-same-dest/my/app/Component-preload.js",
125 | 				sExpectedFileSource: "test/preload/expected/component_default_options/my/app/Component-preload.js",
126 | 				sMessage: "component preload JS should be correctly created."
127 | 			});
128 | 		});
129 | 	});
130 | });
131 | 


--------------------------------------------------------------------------------
/test/theme/expected/compress_option/library-RTL.css:
--------------------------------------------------------------------------------
1 | .foo{float:right;color:#f00}
2 | 


--------------------------------------------------------------------------------
/test/theme/expected/compress_option/library-parameters.json:
--------------------------------------------------------------------------------
1 | {"myColor":"#f00"}
2 | 


--------------------------------------------------------------------------------
/test/theme/expected/compress_option/library.css:
--------------------------------------------------------------------------------
1 | .foo{float:left;color:#f00}
2 | 


--------------------------------------------------------------------------------
/test/theme/expected/default_options/library-RTL.css:
--------------------------------------------------------------------------------
1 | .foo {
2 |   float: right;
3 |   color: #ff0000;
4 | }
5 | 


--------------------------------------------------------------------------------
/test/theme/expected/default_options/library-parameters.json:
--------------------------------------------------------------------------------
1 | {
2 |     "myColor": "#ff0000"
3 | }
4 | 


--------------------------------------------------------------------------------
/test/theme/expected/default_options/library.css:
--------------------------------------------------------------------------------
1 | .foo {
2 |   float: left;
3 |   color: #ff0000;
4 | }
5 | 


--------------------------------------------------------------------------------
/test/theme/expected/rootPaths_option/library-RTL.css:
--------------------------------------------------------------------------------
1 | .foo {
2 |   float: right;
3 |   color: #ff0000;
4 | }
5 | .bar {
6 |   background-color: #ff0000;
7 |   color: #ffffff;
8 | }
9 | 


--------------------------------------------------------------------------------
/test/theme/expected/rootPaths_option/library-parameters.json:
--------------------------------------------------------------------------------
1 | {
2 |     "myOtherColor": "#ffffff"
3 | }
4 | 


--------------------------------------------------------------------------------
/test/theme/expected/rootPaths_option/library.css:
--------------------------------------------------------------------------------
1 | .foo {
2 |   float: left;
3 |   color: #ff0000;
4 | }
5 | .bar {
6 |   background-color: #ff0000;
7 |   color: #ffffff;
8 | }
9 | 


--------------------------------------------------------------------------------
/test/theme/fixtures/lib1/my/theme/foo/foo.less:
--------------------------------------------------------------------------------
1 | @myColor: #ff0000;
2 | 
3 | .foo {
4 |   float: left;
5 |   color: @myColor;
6 | }
7 | 


--------------------------------------------------------------------------------
/test/theme/fixtures/lib2/my/theme/bar/bar.less:
--------------------------------------------------------------------------------
1 | @import "../foo/foo.less";
2 | 
3 | @myOtherColor: contrast(@myColor);
4 | 
5 | .bar {
6 |   background-color: @myColor;
7 |   color: @myOtherColor;
8 | }
9 | 


--------------------------------------------------------------------------------
/test/theme_test.js:
--------------------------------------------------------------------------------
 1 | /* eslint-env mocha */
 2 | "use strict";
 3 | 
 4 | const fileContent = require("./asserts/fileContent");
 5 | function themeTestcase(sFolderName) {
 6 | 	return function() {
 7 | 		fileContent.equal({
 8 | 			sActualFileSource: "tmp/theme/" + sFolderName + "/library.css",
 9 | 			sExpectedFileSource: "test/theme/expected/" + sFolderName + "/library.css",
10 | 			sMessage: "css file should be correctly created."
11 | 		});
12 | 
13 | 		fileContent.equal({
14 | 			sActualFileSource: "tmp/theme/" + sFolderName + "/library-RTL.css",
15 | 			sExpectedFileSource: "test/theme/expected/" + sFolderName + "/library-RTL.css",
16 | 			sMessage: "rtl css file should be correctly created."
17 | 		});
18 | 
19 | 		fileContent.equal({
20 | 			sActualFileSource: "tmp/theme/" + sFolderName + "/library-parameters.json",
21 | 			sExpectedFileSource: "test/theme/expected/" + sFolderName + "/library-parameters.json",
22 | 			sMessage: "parameters file should be correctly created."
23 | 		});
24 | 	};
25 | }
26 | 
27 | describe("openui5_theme", function() {
28 | 	it("default_options", themeTestcase("default_options"));
29 | 
30 | 	it("compress_option", themeTestcase("compress_option"));
31 | 
32 | 	it("rootPaths_option", themeTestcase("rootPaths_option"));
33 | });
34 | 


--------------------------------------------------------------------------------