@adobe/alloy 2.21.0-beta.0 → 2.21.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/libEs5/components/Audiences/injectProcessDestinations.js +1 -1
  2. package/libEs5/components/Context/index.js +1 -1
  3. package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +4 -4
  4. package/libEs5/components/DataCollector/index.js +2 -2
  5. package/libEs5/components/DecisioningEngine/createConsequenceAdapter.js +1 -1
  6. package/libEs5/components/DecisioningEngine/createContextProvider.js +1 -1
  7. package/libEs5/components/DecisioningEngine/createEvaluableRulesetPayload.js +1 -1
  8. package/libEs5/components/DecisioningEngine/createEventRegistry.js +1 -1
  9. package/libEs5/components/DecisioningEngine/createOnResponseHandler.js +1 -1
  10. package/libEs5/components/DecisioningEngine/createSubscribeRulesetItems.js +1 -1
  11. package/libEs5/components/DecisioningEngine/index.js +1 -1
  12. package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +4 -4
  13. package/libEs5/components/Identity/createLegacyIdentity.js +1 -1
  14. package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +4 -4
  15. package/libEs5/components/LegacyMediaAnalytics/createGetInstance.js +1 -1
  16. package/libEs5/components/LegacyMediaAnalytics/createLegacyMediaComponent.js +1 -1
  17. package/libEs5/components/LibraryInfo/index.js +6 -6
  18. package/libEs5/components/Personalization/createApplyPropositions.js +6 -6
  19. package/libEs5/components/Personalization/createClickStorage.js +1 -1
  20. package/libEs5/components/Personalization/createFetchDataHandler.js +5 -5
  21. package/libEs5/components/Personalization/createInteractionStorage.js +6 -6
  22. package/libEs5/components/Personalization/createPersonalizationDetails.js +5 -5
  23. package/libEs5/components/Personalization/createPreprocessors.js +1 -1
  24. package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +5 -5
  25. package/libEs5/components/Personalization/dom-actions/clicks/collectInteractions.js +5 -5
  26. package/libEs5/components/Personalization/dom-actions/dom/selectNodesWithEq.js +4 -4
  27. package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +1 -1
  28. package/libEs5/components/Personalization/dom-actions/scripts.js +1 -1
  29. package/libEs5/components/Personalization/dom-actions/setStyles.js +2 -2
  30. package/libEs5/components/Personalization/event.js +1 -1
  31. package/libEs5/components/Personalization/flicker/index.js +1 -1
  32. package/libEs5/components/Personalization/handlers/createProcessDomAction.js +1 -1
  33. package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +1 -1
  34. package/libEs5/components/Personalization/handlers/createProcessPropositions.js +5 -5
  35. package/libEs5/components/Personalization/handlers/injectCreateProposition.js +1 -1
  36. package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +1 -1
  37. package/libEs5/components/Personalization/index.js +1 -1
  38. package/libEs5/components/Personalization/utils/metaUtils.js +2 -2
  39. package/libEs5/components/Privacy/createComponent.js +1 -1
  40. package/libEs5/components/Privacy/createConsentHashStore.js +2 -2
  41. package/libEs5/components/Privacy/parseConsentCookie.js +4 -4
  42. package/libEs5/components/StreamingMedia/validateMediaEventOptions.js +5 -5
  43. package/libEs5/constants/libraryVersion.js +1 -1
  44. package/libEs5/constants/propositionEventType.js +1 -1
  45. package/libEs5/core/buildAndValidateConfig.js +6 -6
  46. package/libEs5/core/createEvent.js +5 -5
  47. package/libEs5/core/createEventManager.js +3 -3
  48. package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +5 -5
  49. package/libEs5/core/network/injectSendNetworkRequest.js +1 -1
  50. package/libEs5/utils/assignConcatArrayValues.js +5 -5
  51. package/libEs5/utils/createLoggingCookieJar.js +1 -1
  52. package/libEs5/utils/createSubscription.js +5 -5
  53. package/libEs5/utils/filterObject.js +1 -1
  54. package/libEs5/utils/flattenArray.js +5 -5
  55. package/libEs5/utils/flattenObject.js +5 -5
  56. package/libEs5/utils/getBrowser.js +1 -1
  57. package/libEs5/utils/injectFireReferrerHideableImage.js +4 -4
  58. package/libEs5/utils/parseUrl.js +1 -1
  59. package/libEs5/utils/request/createRequestParams.js +2 -2
  60. package/libEs5/utils/validation/createDeprecatedValidator.js +3 -3
  61. package/libEs5/utils/validation/index.js +1 -1
  62. package/libEs6/constants/libraryVersion.js +1 -1
  63. package/package.json +23 -22
  64. package/scripts/build-alloy.js +125 -0
@@ -13,4 +13,4 @@ governing permissions and limitations under the License.
13
13
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
14
14
  // see babel-plugin-version
15
15
 
16
- export default "2.21.0-beta.0";
16
+ export default "2.21.0-beta.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.21.0-beta.0",
3
+ "version": "2.21.0-beta.2",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "type": "module",
6
6
  "main": "libEs5/index.js",
@@ -9,6 +9,9 @@
9
9
  "libEs5",
10
10
  "libEs6"
11
11
  ],
12
+ "bin": {
13
+ "build-alloy": "scripts/build-alloy.js"
14
+ },
12
15
  "scripts": {
13
16
  "clean": "rimraf dist distTest libEs5 libEs6",
14
17
  "lint": "eslint --cache --fix \"*.js\" \"{src,test,scripts}/**/*.js\"",
@@ -28,10 +31,9 @@
28
31
  "test:functional:build:prod": "rollup -c --environment BASE_CODE_MIN,NPM_PACKAGE_PROD",
29
32
  "test:scripts": "jasmine --config=scripts/specs/jasmine.json",
30
33
  "sandbox:build": "rollup -c --environment SANDBOX && cd sandbox && npm run build",
31
- "sandbox:build:custom": "SANDBOX=true npm run build:custom -- --exclude personalization && cd sandbox && npm run build && npm run start",
32
34
  "dev": "concurrently --names build,sandbox \"rollup -c -w --environment SANDBOX\" \"cd sandbox && export REACT_APP_NONCE=321 && npm start\"",
33
- "build": "npm run format && npm run lint && npm run clean && rollup -c --environment BASE_CODE_MIN,STANDALONE,STANDALONE_MIN && echo \"Base Code:\" && cat distTest/baseCode.min.js",
34
- "build:custom": "npm run clean && rollup -c --environment BASE_CODE_MIN,NPM_PACKAGE_LOCAL && node scripts/helpers/customBuild.js",
35
+ "build": "npm run clean && rollup -c --environment BASE_CODE_MIN,STANDALONE,STANDALONE_MIN && echo \"Base Code:\" && cat distTest/baseCode.min.js",
36
+ "build:cli": "node scripts/build-alloy.js",
35
37
  "prepare": "husky && cd sandbox && npm install",
36
38
  "prepublishOnly": "rimraf libEs5 libEs6 && babel src -d libEs5 --env-name npmEs5 && babel src -d libEs6 --env-name npmEs6",
37
39
  "checkthattestfilesexist": "./scripts/checkThatTestFilesExist.js",
@@ -75,22 +77,21 @@
75
77
  "uuid": "^9.0.1"
76
78
  },
77
79
  "devDependencies": {
78
- "@adobe/alloy": "^2.20.0",
79
- "@babel/cli": "^7.24.5",
80
- "@babel/core": "^7.24.5",
81
- "@babel/eslint-parser": "^7.24.5",
80
+ "@adobe/alloy": "^2.21.0-beta.1",
81
+ "@babel/cli": "^7.24.7",
82
+ "@babel/core": "^7.24.7",
83
+ "@babel/eslint-parser": "^7.24.7",
82
84
  "@babel/plugin-proposal-object-rest-spread": "^7.3.2",
83
- "@babel/plugin-transform-runtime": "^7.24.3",
84
- "@babel/plugin-transform-template-literals": "^7.24.1",
85
- "@babel/preset-env": "^7.24.5",
86
- "@babel/types": "^7.24.5",
87
- "@eslint/js": "^9.2.0",
85
+ "@babel/plugin-transform-runtime": "^7.24.7",
86
+ "@babel/plugin-transform-template-literals": "^7.24.7",
87
+ "@babel/preset-env": "^7.24.7",
88
+ "@babel/types": "^7.24.7",
89
+ "@eslint/js": "^9.4.0",
88
90
  "@octokit/rest": "^20.1.1",
89
91
  "@rollup/plugin-babel": "^6.0.4",
90
- "@rollup/plugin-commonjs": "^25.0.7",
92
+ "@rollup/plugin-commonjs": "^26.0.1",
91
93
  "@rollup/plugin-node-resolve": "^15.2.3",
92
94
  "@rollup/plugin-terser": "^0.4.4",
93
- "babel-plugin-version": "^0.2.3",
94
95
  "bundlesize": "^0.18.2",
95
96
  "chai": "^5.1.1",
96
97
  "chalk": "^5.3.0",
@@ -105,8 +106,8 @@
105
106
  "eslint-plugin-prettier": "^5.1.3",
106
107
  "eslint-plugin-testcafe": "^0.2.1",
107
108
  "force-resolutions": "^1.0.11",
108
- "glob": "^10.3.15",
109
- "globals": "^15.2.0",
109
+ "glob": "^10.4.1",
110
+ "globals": "^15.4.0",
110
111
  "handlebars": "^4.7.8",
111
112
  "husky": "^9.0.11",
112
113
  "jasmine": "^5.1.0",
@@ -123,20 +124,20 @@
123
124
  "karma-safari-launcher": "^1.0.0",
124
125
  "karma-sauce-launcher": "^4.3.6",
125
126
  "karma-spec-reporter": "0.0.36",
126
- "lint-staged": "^15.2.2",
127
- "prettier": "^3.2.5",
127
+ "lint-staged": "^15.2.5",
128
+ "prettier": "^3.3.1",
128
129
  "promise-polyfill": "^8.3.0",
129
130
  "read-cache": "^1.0.0",
130
131
  "recursive-readdir": "^2.2.3",
131
132
  "request": "^2.88.0",
132
133
  "rimraf": "^5.0.7",
133
- "rollup": "^4.17.2",
134
+ "rollup": "^4.18.0",
134
135
  "rollup-plugin-glob-import": "^0.5.0",
135
136
  "rollup-plugin-istanbul": "^5.0.0",
136
137
  "rollup-plugin-license": "^3.4.0",
137
138
  "semver": "^7.6.2",
138
139
  "staged-git-files": "^1.3.0",
139
- "start-server-and-test": "^2.0.3",
140
+ "start-server-and-test": "^2.0.4",
140
141
  "testcafe": "^3.6.0",
141
142
  "testcafe-browser-provider-saucelabs": "^3.0.0",
142
143
  "testcafe-reporter-junit": "^3.0.2",
@@ -151,6 +152,6 @@
151
152
  }
152
153
  },
153
154
  "optionalDependencies": {
154
- "@rollup/rollup-linux-x64-gnu": "^4.17.2"
155
+ "@rollup/rollup-linux-x64-gnu": "^4.18.0"
155
156
  }
156
157
  }
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+
3
+ /*
4
+ Copyright 2023 Adobe. All rights reserved.
5
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License. You may obtain a copy
7
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ Unless required by applicable law or agreed to in writing, software distributed under
9
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
10
+ OF ANY KIND, either express or implied. See the License for the specific language
11
+ governing permissions and limitations under the License.
12
+ */
13
+
14
+ import fs from "fs";
15
+ import path from "path";
16
+ import { rollup } from "rollup";
17
+ import yargs from "yargs/yargs";
18
+ // eslint-disable-next-line import/extensions
19
+ import { hideBin } from "yargs/helpers";
20
+ import conditionalBuildBabelPlugin from "./helpers/conditionalBuildBabelPlugin.js";
21
+ import { buildConfig } from "../rollup.config.js";
22
+
23
+ const dirname = import.meta.dirname;
24
+
25
+ // Path to componentCreators.js
26
+ const componentCreatorsPath = path.join(
27
+ dirname,
28
+ "../src/core/componentCreators.js",
29
+ );
30
+
31
+ // Read componentCreators.js
32
+ const componentCreatorsContent = fs.readFileSync(componentCreatorsPath, "utf8");
33
+
34
+ // Extract optional components based on @skipwhen directive
35
+ const optionalComponents = componentCreatorsContent
36
+ .split("\n")
37
+ .filter((line) => line.trim().startsWith("/* @skipwhen"))
38
+ .map((line) => {
39
+ const match = line.match(/ENV\.alloy_([a-zA-Z0-9]+) === false/);
40
+ if (match) {
41
+ const [, componentName] = match;
42
+ return componentName.toLowerCase(); // Ensure this matches the expected format for exclusion
43
+ }
44
+ return null;
45
+ })
46
+ .filter(Boolean);
47
+
48
+ const getDefaultPath = () => {
49
+ return process.cwd();
50
+ };
51
+
52
+ const argv = yargs(hideBin(process.argv))
53
+ .scriptName("build-alloy")
54
+ .example([
55
+ [`$0 --exclude ${optionalComponents.slice(0, 2).join(" ")}`],
56
+ [`$0 --minify --exclude ${optionalComponents.slice(0, 2).join(" ")}`],
57
+ ])
58
+ .option("exclude", {
59
+ describe: "components that can be excluded from the build",
60
+ choices: optionalComponents,
61
+ type: "array",
62
+ alias: "e",
63
+ default: [],
64
+ })
65
+ .option("minify", {
66
+ type: "boolean",
67
+ default: false,
68
+ alias: "m",
69
+ })
70
+ .option("outputDir", {
71
+ alias: "o",
72
+ default: getDefaultPath(),
73
+ })
74
+ .coerce("outputDir", (opt) => {
75
+ if (opt !== getDefaultPath()) {
76
+ opt = `${getDefaultPath()}${path.sep}${opt}`;
77
+ }
78
+
79
+ try {
80
+ const stats = fs.statSync(opt);
81
+ if (!stats.isDirectory()) {
82
+ throw new Error("Output directory must be a valid directory path.");
83
+ }
84
+ } catch (error) {
85
+ throw new Error("Output directory must be a valid directory path.");
86
+ }
87
+
88
+ return opt.replace(new RegExp(`${path.sep}+$`, "g"), "");
89
+ }).argv;
90
+
91
+ const getFile = () => {
92
+ return `${[argv.outputDir, `alloy${argv.minify ? ".min" : ""}.js`].join(path.sep)}`;
93
+ };
94
+
95
+ const getFileSizeInKB = (filePath) => {
96
+ const stats = fs.statSync(filePath);
97
+ const fileSizeInBytes = stats.size;
98
+ return `${(fileSizeInBytes / 1024).toFixed(2)} K`;
99
+ };
100
+
101
+ const buildWithComponents = async () => {
102
+ const rollupConfig = buildConfig({
103
+ file: getFile(),
104
+ minify: argv.minify,
105
+ babelPlugins: [
106
+ conditionalBuildBabelPlugin(
107
+ argv.exclude.reduce((acc, module) => {
108
+ acc[`alloy_${module}`] = "false";
109
+ return acc;
110
+ }, {}),
111
+ ),
112
+ ],
113
+ });
114
+
115
+ const bundle = await rollup(rollupConfig);
116
+ await bundle.write(rollupConfig.output[0]);
117
+ console.log(
118
+ `🎉 Wrote ${path.relative(
119
+ process.cwd(),
120
+ rollupConfig.output[0].file,
121
+ )} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
122
+ );
123
+ };
124
+
125
+ buildWithComponents();