@teambit/application 1.0.108 → 1.0.109

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.
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/application-preview"]=t():e["teambit.harmony/application-preview"]=t()}(self,(()=>(()=>{"use strict";var e={14576:(e,t,o)=>{var n={id:"teambit.harmony/application@1.0.109",homepage:"https://bit.cloud/teambit/harmony/application",exported:!0};function r(){const e=i(o(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/app.svg"}));a.__bit_component=n,t.Logo=a},87363:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>l,compositions_metadata:()=>f,overview:()=>u});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(14576);o(87363);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var a=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(this,arguments)}var c={},s="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,a);return(0,r.mdx)(s,p({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const l=[t],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.108/dist/application.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.108/dist/application.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.109/dist/application.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.109/dist/application.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/application",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/application",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "application",
9
- "version": "1.0.108"
9
+ "version": "1.0.109"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,17 +17,17 @@
17
17
  "@teambit/lane-id": "0.0.311",
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/bit-error": "0.0.404",
20
- "@teambit/builder": "1.0.108",
21
- "@teambit/component": "1.0.108",
22
- "@teambit/isolator": "1.0.108",
23
- "@teambit/envs": "1.0.108",
24
- "@teambit/logger": "0.0.933",
20
+ "@teambit/builder": "1.0.109",
21
+ "@teambit/component": "1.0.109",
22
+ "@teambit/isolator": "1.0.109",
23
+ "@teambit/envs": "1.0.109",
24
+ "@teambit/logger": "0.0.934",
25
25
  "@teambit/cli-table": "0.0.46",
26
- "@teambit/cli": "0.0.840",
27
- "@teambit/aspect-loader": "1.0.108",
28
- "@teambit/scope": "1.0.108",
29
- "@teambit/watcher": "1.0.108",
30
- "@teambit/workspace": "1.0.108"
26
+ "@teambit/cli": "0.0.841",
27
+ "@teambit/aspect-loader": "1.0.109",
28
+ "@teambit/scope": "1.0.109",
29
+ "@teambit/watcher": "1.0.109",
30
+ "@teambit/workspace": "1.0.109"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash": "4.14.165",
@@ -35,7 +35,7 @@
35
35
  "@types/mocha": "9.1.0",
36
36
  "@types/jest": "^29.2.2",
37
37
  "@types/testing-library__jest-dom": "^5.9.5",
38
- "@teambit/harmony.envs.core-aspect-env": "0.0.13"
38
+ "@teambit/harmony.envs.core-aspect-env": "0.0.14"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^17.0.0 || ^18.0.0",
@@ -1,55 +0,0 @@
1
- import { Component } from '@teambit/component';
2
- import { Capsule, Network } from '@teambit/isolator';
3
- import { BuildContext, PipeName, TaskResults } from '@teambit/builder';
4
- import { LaneId } from '@teambit/lane-id';
5
- import { AppContext } from './app-context';
6
-
7
- export type AppBuildContextCreate = {
8
- appContext: AppContext;
9
- buildContext: BuildContext;
10
- name: string;
11
- appComponent: Component;
12
- artifactsDir: string;
13
- capsule: Capsule;
14
- };
15
-
16
- export class AppBuildContext extends AppContext implements BuildContext {
17
- constructor(
18
- readonly appContext: AppContext,
19
- readonly capsuleNetwork: Network,
20
- readonly previousTasksResults: TaskResults[],
21
- readonly pipeName: PipeName,
22
- readonly capsule: Capsule,
23
- readonly name: string,
24
- readonly appComponent: Component,
25
- readonly artifactsDir: string,
26
- readonly laneId?: LaneId | undefined
27
- ) {
28
- super(
29
- appContext.appName,
30
- appContext.harmony,
31
- appContext.dev,
32
- appContext.appComponent,
33
- appContext.workdir,
34
- appContext.execContext,
35
- appContext.hostRootDir,
36
- appContext.port,
37
- appContext.workspaceComponentPath,
38
- appContext.envVariables
39
- );
40
- }
41
-
42
- static create({ name, capsule, appComponent, artifactsDir, appContext, buildContext }: AppBuildContextCreate) {
43
- return new AppBuildContext(
44
- appContext,
45
- buildContext.capsuleNetwork,
46
- buildContext.previousTasksResults,
47
- buildContext.pipeName,
48
- capsule,
49
- name,
50
- appComponent,
51
- artifactsDir,
52
- buildContext.laneId
53
- );
54
- }
55
- }
@@ -1,26 +0,0 @@
1
- import { ArtifactDefinition } from '@teambit/builder';
2
-
3
- export interface AppBuildResult {
4
- artifacts?: ArtifactDefinition[];
5
-
6
- /**
7
- * errors thrown during the build process.
8
- */
9
- errors?: Error[];
10
-
11
- /**
12
- * warnings thrown during the build process.
13
- */
14
- warnings?: string[];
15
-
16
- /**
17
- * metadata to persist.
18
- * this is the only property that actually gets saved into the objects (in builder aspect, aspectsData.buildDeployContexts[deployContext]).
19
- * in some scenarios, the build and deploy pipelines run in different processes, and then the only data the deploy
20
- * gets is what saved into the objects.
21
- * examples of data that gets save here:
22
- * React: { publicDir, ssrPublicDir }.
23
- * Node: { mainFile, artifactsDir }.
24
- */
25
- metadata?: Record<string, any>;
26
- }
package/app-context.ts DELETED
@@ -1,97 +0,0 @@
1
- import { ExecutionContext } from '@teambit/envs';
2
- import { Harmony } from '@teambit/harmony';
3
- import { Component } from '@teambit/component';
4
- import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';
5
-
6
- export class AppContext extends ExecutionContext {
7
- constructor(
8
- /**
9
- * name of the app
10
- */
11
- readonly appName: string,
12
-
13
- /**
14
- * instance of harmony.
15
- */
16
- readonly harmony: Harmony,
17
-
18
- /**
19
- * determine whether to serve the application in dev mode.
20
- */
21
- readonly dev: boolean,
22
-
23
- /**
24
- * application component instance.
25
- */
26
- readonly appComponent: Component,
27
-
28
- /**
29
- * working directory of the component.
30
- */
31
- readonly workdir: string,
32
-
33
- /**
34
- * execution context of the app.
35
- */
36
- readonly execContext: ExecutionContext,
37
-
38
- /**
39
- * A path for the host root dir
40
- * Host root dir is the dir where we run the app from
41
- * This can be used in different bundle options which run require.resolve
42
- * for example when configuring webpack aliases or webpack expose loader on the peers deps
43
- */
44
- readonly hostRootDir?: string,
45
-
46
- /**
47
- * A port to run the app on
48
- */
49
- readonly port?: number,
50
-
51
- /**
52
- * path to the application component in the workspace
53
- */
54
- readonly workspaceComponentPath?: string,
55
-
56
- /**
57
- * list of env variables to include.
58
- */
59
- readonly envVariables: Record<string, string> = {}
60
- ) {
61
- super(execContext.upper, execContext.envRuntime, execContext.components);
62
- }
63
-
64
- /**
65
- * return a logger instance for the env.
66
- */
67
- createLogger(name?: string): Logger {
68
- const loggerMain = this.harmony.get<LoggerMain>(LoggerAspect.id);
69
- const appComponentId = this.appComponent.id;
70
- const loggerName = name ? `${appComponentId.toString()}::${name}` : appComponentId.toString();
71
-
72
- return loggerMain.createLogger(loggerName);
73
- }
74
-
75
- /**
76
- * get an instance of an aspect.
77
- * make sure it is loaded prior to requesting it.
78
- */
79
- getAspect<T>(aspectId: string): T | undefined {
80
- return this.harmony.get<T>(aspectId);
81
- }
82
-
83
- static compose(appContext: AppContext, overrides?: Partial<AppContext>) {
84
- return new AppContext(
85
- overrides?.appName || appContext?.appName,
86
- overrides?.harmony || appContext?.harmony,
87
- overrides?.dev || appContext?.dev,
88
- overrides?.appComponent || appContext?.appComponent,
89
- overrides?.workdir || appContext?.workdir,
90
- overrides?.execContext || appContext?.execContext,
91
- overrides?.hostRootDir || appContext?.hostRootDir,
92
- overrides?.port || appContext?.port,
93
- overrides?.workspaceComponentPath || appContext?.workspaceComponentPath,
94
- overrides?.envVariables || appContext?.envVariables
95
- );
96
- }
97
- }
@@ -1,38 +0,0 @@
1
- import { Artifact, ArtifactList } from '@teambit/builder';
2
- import { AppBuildContext } from './app-build-context';
3
-
4
- export class AppDeployContext extends AppBuildContext {
5
- constructor(
6
- /**
7
- * app build context.
8
- */
9
- appBuildContext: AppBuildContext,
10
-
11
- /**
12
- * artifacts generated upon component build.
13
- */
14
- readonly artifacts: ArtifactList<Artifact>,
15
-
16
- /**
17
- * public dir generated by the build.
18
- */
19
- readonly publicDir?: string,
20
-
21
- /**
22
- * ssr dir generated by the build.
23
- */
24
- readonly ssrPublicDir?: string
25
- ) {
26
- super(
27
- appBuildContext.appContext,
28
- appBuildContext.capsuleNetwork,
29
- appBuildContext.previousTasksResults,
30
- appBuildContext.pipeName,
31
- appBuildContext.capsule,
32
- appBuildContext.name,
33
- appBuildContext.appComponent,
34
- appBuildContext.artifactsDir,
35
- appBuildContext.laneId
36
- );
37
- }
38
- }
package/app-instance.ts DELETED
@@ -1,36 +0,0 @@
1
- export type ApplicationInstance = {
2
- /**
3
- * port in which app is running.
4
- */
5
- port?: number;
6
-
7
- /**
8
- * name of the app
9
- */
10
- appName?: string;
11
-
12
- /**
13
- * url of the running app.
14
- */
15
- url?: string;
16
- };
17
-
18
- /**
19
- * an instance of an application deployment.
20
- */
21
- export type ApplicationDeployment = {
22
- /**
23
- * timestamp of the deployment.
24
- */
25
- timestamp?: string;
26
-
27
- /**
28
- * name of the deployed app.
29
- */
30
- appName?: string;
31
-
32
- /**
33
- * url the deployed app.
34
- */
35
- url?: string;
36
- };
package/app-server.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Application } from './application';
2
-
3
- export class AppServer {
4
- constructor(private app: Application) {}
5
-
6
- get name() {
7
- return this.app.name;
8
- }
9
- }
package/app-type-list.ts DELETED
@@ -1,25 +0,0 @@
1
- import { EnvContext, EnvHandler } from '@teambit/envs';
2
- import { ApplicationType } from './application-type';
3
-
4
- export type AppTypeListOptions = {
5
- name?: string;
6
- };
7
-
8
- export class AppTypeList {
9
- constructor(
10
- readonly name: string,
11
- private appTypes: EnvHandler<ApplicationType<any>>[],
12
- private context: EnvContext
13
- ) {}
14
-
15
- compute(): ApplicationType<any>[] {
16
- return this.appTypes.map((appType) => appType(this.context));
17
- }
18
-
19
- static from(appTypes: EnvHandler<ApplicationType<any>>[], options: AppTypeListOptions = {}): EnvHandler<AppTypeList> {
20
- return (context: EnvContext) => {
21
- const name = options.name || 'app-type-list';
22
- return new AppTypeList(name, appTypes, context);
23
- };
24
- }
25
- }
@@ -1,24 +0,0 @@
1
- import { PluginDefinition } from '@teambit/aspect-loader';
2
- import { BitError } from '@teambit/bit-error';
3
- import { MainRuntime } from '@teambit/cli';
4
- import { Application } from './application';
5
- import { ApplicationType } from './application-type';
6
- import { ApplicationSlot } from './application.main.runtime';
7
-
8
- export class AppTypePlugin implements PluginDefinition {
9
- constructor(readonly pattern: string, private appType: ApplicationType<unknown>, private appSlot: ApplicationSlot) {}
10
-
11
- runtimes = [MainRuntime.name];
12
-
13
- register(object: any) {
14
- const app = this.appType.createApp(object);
15
- this.validateApp(app);
16
- this.appSlot.register([app]);
17
- }
18
-
19
- private validateApp(app: Application) {
20
- if (app.name.includes(' ')) {
21
- throw new BitError(`app name "${app.name}" is invalid. spaces are not permitted`);
22
- }
23
- }
24
- }
package/app.cmd.ts DELETED
@@ -1,46 +0,0 @@
1
- // eslint-disable-next-line max-classes-per-file
2
- import { Command, CommandOptions } from '@teambit/cli';
3
- // import { Logger } from '@teambit/logger';
4
- import chalk from 'chalk';
5
- import { CLITable } from '@teambit/cli-table';
6
- import { ApplicationMain } from './application.main.runtime';
7
-
8
- export class AppListCmd implements Command {
9
- name = 'list';
10
- description = 'list all registered apps';
11
- alias = '';
12
- group = 'apps';
13
- helpUrl = 'reference/reference/cli-reference';
14
- options = [['j', 'json', 'return the component data in json format']] as CommandOptions;
15
-
16
- constructor(private applicationAspect: ApplicationMain) {}
17
-
18
- async report(args: [string], { json }: { json: boolean }) {
19
- const appComponents = this.applicationAspect.mapApps();
20
- if (json) return JSON.stringify(appComponents, null, 2);
21
- if (!appComponents.length) return chalk.yellow('no apps found');
22
-
23
- const rows = appComponents.flatMap(([id, apps]) => {
24
- return apps.map((app) => [id, app.name]);
25
- });
26
-
27
- const table = new CLITable(['id', 'name'], rows);
28
- return table.render();
29
- }
30
- }
31
-
32
- export class AppCmd implements Command {
33
- name = 'app <sub-command>';
34
- description = 'Manages apps';
35
- helpUrl = 'docs/getting-started/composing/create-apps';
36
- alias = 'apps';
37
- group = 'apps';
38
- commands: Command[] = [];
39
- options = [] as CommandOptions;
40
-
41
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- async report(args: [string]) {
43
- // it should never be here. Yargs throws an error before reaching this method.
44
- return `Please specify a sub-command`;
45
- }
46
- }
package/app.plugin.ts DELETED
@@ -1,17 +0,0 @@
1
- import { PluginDefinition } from '@teambit/aspect-loader';
2
- import { MainRuntime } from '@teambit/cli';
3
- import { ApplicationSlot } from './application.main.runtime';
4
-
5
- export const BIT_APP_PATTERN = '*.bit-app.*';
6
-
7
- export class AppPlugin implements PluginDefinition {
8
- constructor(private appSlot: ApplicationSlot) {}
9
-
10
- pattern = BIT_APP_PATTERN;
11
-
12
- runtimes = [MainRuntime.name];
13
-
14
- register(object: any) {
15
- return this.appSlot.register([object]);
16
- }
17
- }
@@ -1,18 +0,0 @@
1
- import { Application } from './application';
2
-
3
- export interface ApplicationType<T> {
4
- /**
5
- * name of the type of the app. e.g. `react-app`
6
- */
7
- name: string;
8
-
9
- /**
10
- * pattern of the app.
11
- */
12
- globPattern?: string;
13
-
14
- /**
15
- * a function that creates the app instance.
16
- */
17
- createApp(options: T): Application;
18
- }
@@ -1,5 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const ApplicationAspect = Aspect.create({
4
- id: 'teambit.harmony/application',
5
- });