-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standalone and independently versioned browser-destinations (#1276)
This patch makes each browser destinations accessible through NPM by making it standalone and independently versioned. This will let customers install the destinations from NPM and have it packaged into their main app bundle through webpack or other bundlers, thus eliminating the reliance on CDN and a lot of concurrent network requests.
- Loading branch information
Showing
480 changed files
with
1,923 additions
and
841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "@segment/browser-destination-runtime", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"build": "yarn build:esm && yarn build:cjs", | ||
"build:esm": "tsc --outDir ./dist/esm", | ||
"build:cjs": "tsc --module commonjs --outDir ./dist/cjs" | ||
}, | ||
"exports": { | ||
".": { | ||
"require": "./dist/cjs/index.js", | ||
"default": "./dist/esm/index.js" | ||
}, | ||
"./load-script": { | ||
"require": "./dist/cjs/load-script.js", | ||
"default": "./dist/esm/load-script.js" | ||
}, | ||
"./plugin": { | ||
"require": "./dist/cjs/plugin.js", | ||
"default": "./dist/esm/plugin.js" | ||
}, | ||
"./resolve-when": { | ||
"require": "./dist/cjs/resolve-when.js", | ||
"default": "./dist/esm/resolve-when.js" | ||
}, | ||
"./shim": { | ||
"require": "./dist/cjs/shim.js", | ||
"default": "./dist/esm/shim.js" | ||
}, | ||
"./types": { | ||
"require": "./dist/cjs/types.js", | ||
"default": "./dist/esm/types.js" | ||
} | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"dist/esm/index.d.ts" | ||
], | ||
"load-script": [ | ||
"dist/esm/load-script.d.ts" | ||
], | ||
"plugin": [ | ||
"dist/esm/plugin.d.ts" | ||
], | ||
"resolve-when": [ | ||
"dist/esm/resolve-when.d.ts" | ||
], | ||
"shim": [ | ||
"dist/esm/shim.d.ts" | ||
], | ||
"types": [ | ||
"dist/esm/types.d.ts" | ||
] | ||
} | ||
}, | ||
"dependencies": { | ||
"@segment/actions-core": "^3.70.0" | ||
}, | ||
"devDependencies": { | ||
"@segment/analytics-next": "*" | ||
}, | ||
"peerDependencies": { | ||
"@segment/analytics-next": "*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ions/src/runtime/__tests__/plugin.test.ts → ...tion-runtime/src/__tests__/plugin.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { BrowserDestinationDefinition, PluginFactory, Subscription } from './types' | ||
|
||
export function browserDestination<S, C>(definition: BrowserDestinationDefinition<S, C>): PluginFactory { | ||
const factory = (async (settings: S & { subscriptions?: Subscription[] }) => { | ||
const plugin = await import( | ||
/* webpackChunkName: "actions-plugin" */ | ||
/* webpackMode: "lazy-once" */ | ||
'./plugin' | ||
) | ||
return plugin.generatePlugins(definition, settings, settings.subscriptions || []) | ||
}) as unknown as PluginFactory | ||
|
||
factory.pluginName = definition.name | ||
|
||
return factory | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "esnext", | ||
"removeComments": false, | ||
"baseUrl": "." | ||
}, | ||
"exclude": ["dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/browser-destinations/destinations/adobe-target/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@segment/analytics-browser-actions-adobe-target", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"main": "./dist/cjs", | ||
"module": "./dist/esm", | ||
"scripts": { | ||
"build": "yarn build:esm && yarn build:cjs", | ||
"build-es": "tsc", | ||
"build:cjs": "tsc --module commonjs --outDir ./dist/cjs", | ||
"build:esm": "tsc --outDir ./dist/esm" | ||
}, | ||
"typings": "./dist/esm", | ||
"dependencies": { | ||
"@segment/browser-destination-runtime": "^0.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@segment/analytics-next": "*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ions/adobe-target/__tests__/index.test.ts → .../adobe-target/src/__tests__/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...ns/src/destinations/adobe-target/index.ts → ...ns/destinations/adobe-target/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...target/trackEvent/__tests__/index.test.ts → ...et/src/trackEvent/__tests__/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...inations/adobe-target/trackEvent/index.ts → ...ions/adobe-target/src/trackEvent/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...arget/triggerView/__tests__/index.test.ts → ...t/src/triggerView/__tests__/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...nations/adobe-target/triggerView/index.ts → ...ons/adobe-target/src/triggerView/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...get/upsertProfile/__tests__/index.test.ts → ...src/upsertProfile/__tests__/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...tions/adobe-target/upsertProfile/index.ts → ...s/adobe-target/src/upsertProfile/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
packages/browser-destinations/destinations/adobe-target/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"baseUrl": "." | ||
}, | ||
"include": ["src"], | ||
"exclude": ["dist", "**/__tests__"] | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/browser-destinations/destinations/amplitude-plugins/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@segment/analytics-browser-actions-amplitude-plugins", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"main": "./dist/cjs", | ||
"module": "./dist/esm", | ||
"scripts": { | ||
"build": "yarn build:esm && yarn build:cjs", | ||
"build:cjs": "tsc --module commonjs --outDir ./dist/cjs", | ||
"build:esm": "tsc --outDir ./dist/esm" | ||
}, | ||
"typings": "./dist/esm", | ||
"dependencies": { | ||
"@segment/browser-destination-runtime": "^0.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@segment/analytics-next": "*" | ||
} | ||
} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...c/destinations/amplitude-plugins/index.ts → ...stinations/amplitude-plugins/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ins/sessionId/__tests__/sessionId.test.ts → ...src/sessionId/__tests__/sessionId.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ions/amplitude-plugins/sessionId/index.ts → .../amplitude-plugins/src/sessionId/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/browser-destinations/destinations/amplitude-plugins/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"baseUrl": "." | ||
}, | ||
"include": ["src"], | ||
"exclude": ["dist", "**/__tests__"] | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/browser-destinations/destinations/braze-cloud-plugins/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@segment/analytics-browser-actions-braze-cloud-plugins", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"main": "./dist/cjs", | ||
"module": "./dist/esm", | ||
"scripts": { | ||
"build": "yarn build:esm && yarn build:cjs", | ||
"build:cjs": "tsc --module commonjs --outDir ./dist/cjs", | ||
"build:esm": "tsc --outDir ./dist/esm" | ||
}, | ||
"typings": "./dist/esm", | ||
"dependencies": { | ||
"@segment/analytics-browser-actions-braze": "^0.0.0", | ||
"@segment/browser-destination-runtime": "^0.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@segment/analytics-next": "*" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...destinations/braze-cloud-plugins/index.ts → ...inations/braze-cloud-plugins/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/browser-destinations/destinations/braze-cloud-plugins/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.build.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"baseUrl": "." | ||
}, | ||
"include": ["src"], | ||
"exclude": ["dist", "**/__tests__"] | ||
} |
Oops, something went wrong.