Skip to content

Commit

Permalink
feat(ui5-tooling-modules): addToNamespace=true is the default now
Browse files Browse the repository at this point in the history
  • Loading branch information
petermuessig committed Sep 10, 2024
1 parent 089fdbc commit f607ced
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/ui5-tooling-modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ The following configuration options are just relevant for the `task`:
 

- *addToNamespace*: `boolean|string`
Puts 3rd party modules into the namespace of the Component to make them Component-local. All used 3rd party modules will be moved by default into the sub-namespace `thirdparty` of the Component namespace at build time. If you use a string as value of `addToNamespace` you can define a custom namespace, e.g. `my/namespace/for/libs` which will be nested in the Components' namespace. With that option you can run your application using 3rd party modules in a Fiori launchpad environment. (defaults to `false`, disables *prependPathMappings* when set to `true`)
Puts 3rd party modules into the namespace of the Component to make them Component-local. All used 3rd party modules will be moved by default into the sub-namespace `thirdparty` of the Component namespace at build time. If you use a string as value of `addToNamespace` you can define a custom namespace, e.g. `my/namespace/for/libs` which will be nested in the Components' namespace. With that option you can run your application using 3rd party modules in a Fiori launchpad environment. In some cases (wrong dependency rewrite, wish to keep 3rd party modules in the `resources` path, ...) it might be necessary to disable this option. (defaults to `true`, disables *prependPathMappings* when set to `true`)
 
> :warning: While this works great for any non-UI5 3rd party module, there are limitations for the consumption of UI5 modules from custom control 3rd party modules (NPM packages). The UI5 module names (used for `Object.extend(...)`, aggregation types, ...) are not rewritten and this may cause issues. UI5 assumes that the used module path (slash syntax) is matching the module name (dot syntax). This can lead to issues for `Object.isA(...)` checks, Renderer lookups (when not inlined or referenced by module), or for any other API which derives the module name from the module path or vice versa.
> :warning: While this works great for any non-UI5 3rd party module, there are limitations for the consumption of UI5 modules from custom control 3rd party modules (NPM packages). The UI5 module names (used for `Object.extend(...)`, aggregation types, ...) are not rewritten and this may cause issues. UI5 assumes that the used module path (slash syntax) is matching the module name (dot syntax). This can lead to issues for `Object.isA(...)` checks, Renderer lookups (when not inlined or referenced by module), or for any other API which derives the module name from the module path or vice versa. If you encounter such issues you may consider to disable the option and instruct the loader via `sap.ui.loader.config({ paths: ... })` to load the resources properly.

- *removeScopePrefix*: `boolean`
Removes the scope prefix `@` from the namespace/path of the 3rd party module when adding it to the namespace with the *addToNamespace* option.
Expand Down
1 change: 1 addition & 0 deletions packages/ui5-tooling-modules/lib/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module.exports = async function ({ log, workspace, taskUtil, options }) {
{
debug: false,
skipTransform: false,
addToNamespace: true,
},
options.configuration,
);
Expand Down
3 changes: 2 additions & 1 deletion showcases/ui5-app-simple/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ builder:
afterTask: ui5-tooling-transpile-task
configuration:
debug: true
addToNamespace: true
addToNamespace: false
prependPathMappings: true
- name: ui5-task-zipper
afterTask: generateVersionInfo
configuration:
Expand Down
3 changes: 0 additions & 3 deletions showcases/ui5-app/ui5-pwa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ builder:
afterTask: replaceVersion
- name: ui5-tooling-modules-task
afterTask: replaceVersion
configuration:
prependPathMappings: true
addToNamespace: true
- name: ui5-task-pwa-enabler
afterTask: generateVersionInfo
configuration:
Expand Down
2 changes: 0 additions & 2 deletions showcases/ui5-app/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ builder:
afterTask: ui5-tooling-transpile-task
configuration:
debug: true
prependPathMappings: true
addToNamespace: true
removeScopePrefix: true
includeAssets:
"@octokit/core":
Expand Down
1 change: 0 additions & 1 deletion showcases/ui5-tsapp-webc/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ builder:
afterTask: ui5-tooling-transpile-task
configuration:
debug: true
addToNamespace: true
server:
customMiddleware:
- name: ui5-tooling-transpile-middleware
Expand Down
2 changes: 0 additions & 2 deletions showcases/ui5-tsapp/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ builder:
afterTask: ui5-tooling-transpile-task
configuration:
<<: *cfgModules
prependPathMappings: false
addToNamespace: true
providedDependencies:
- moment
- name: ui5-task-copyright
Expand Down
1 change: 0 additions & 1 deletion showcases/ui5-tslib/ui5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ builder:
afterTask: ui5-tooling-transpile-task
configuration:
debug: true
addToNamespace: true
server:
customMiddleware:
- name: ui5-tooling-transpile-middleware
Expand Down

0 comments on commit f607ced

Please sign in to comment.