@ms-cloudpack/common-types 0.33.0 → 0.33.1

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.
@@ -8,11 +8,16 @@ export interface BundleContext {
8
8
  */
9
9
  moduleType: ModuleType;
10
10
  /**
11
- * True if any of the entry files are typescript, or obviously JSX based on the extension.
11
+ * True if the package requires transpilation (usually with SWC) before bundling. One or more of:
12
+ * - Is internal
13
+ * - Has entry files that are TS or JSX
14
+ * - Has relay capability enabled
12
15
  *
13
- * Note that this calculation does *not* parse the files to check for JSX syntax in files
14
- * without a specific extension. It also only accounts for *entry files* (so things like
15
- * `index.js` which imports `./foo.jsx` wouldn't be detected).
16
+ * Note that the entry files calculation does *not* parse the files to check for JSX syntax
17
+ * in files without a specific extension. It also only accounts for *entry files* (so things
18
+ * like `index.js` which imports `./foo.jsx` wouldn't be detected).
19
+ *
20
+ * Also note this is not used by ori as of writing (it handles this internally).
16
21
  */
17
22
  requiresTranspile: boolean;
18
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BundleContext.d.ts","sourceRoot":"","sources":["../src/BundleContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,eAAe,CAAC;IAExB;;;OAGG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;;;;;OAMG;IACH,iBAAiB,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"BundleContext.d.ts","sourceRoot":"","sources":["../src/BundleContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,eAAe,CAAC;IAExB;;;OAGG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;;;;;;;;;;OAWG;IACH,iBAAiB,EAAE,OAAO,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"BundleContext.js","sourceRoot":"","sources":["../src/BundleContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig } from './CloudpackConfig.js';\nimport type { ModuleType } from './ModuleType.js';\n\nexport interface BundleContext {\n config: CloudpackConfig;\n\n /**\n * Detected module type of the entry files. This will be 'cjs' or 'amd' if any entry file was\n * detected as that type, or 'esm' is the default.\n */\n moduleType: ModuleType;\n\n /**\n * True if any of the entry files are typescript, or obviously JSX based on the extension.\n *\n * Note that this calculation does *not* parse the files to check for JSX syntax in files\n * without a specific extension. It also only accounts for *entry files* (so things like\n * `index.js` which imports `./foo.jsx` wouldn't be detected).\n */\n requiresTranspile: boolean;\n}\n"]}
1
+ {"version":3,"file":"BundleContext.js","sourceRoot":"","sources":["../src/BundleContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig } from './CloudpackConfig.js';\nimport type { ModuleType } from './ModuleType.js';\n\nexport interface BundleContext {\n config: CloudpackConfig;\n\n /**\n * Detected module type of the entry files. This will be 'cjs' or 'amd' if any entry file was\n * detected as that type, or 'esm' is the default.\n */\n moduleType: ModuleType;\n\n /**\n * True if the package requires transpilation (usually with SWC) before bundling. One or more of:\n * - Is internal\n * - Has entry files that are TS or JSX\n * - Has relay capability enabled\n *\n * Note that the entry files calculation does *not* parse the files to check for JSX syntax\n * in files without a specific extension. It also only accounts for *entry files* (so things\n * like `index.js` which imports `./foo.jsx` wouldn't be detected).\n *\n * Also note this is not used by ori as of writing (it handles this internally).\n */\n requiresTranspile: boolean;\n}\n"]}
@@ -37,7 +37,7 @@ export type InternalBundlerCapabilities = {
37
37
  * Do not include the leading dot.
38
38
  */
39
39
  'asset-inline': {
40
- extensions: string[] | Record<string, boolean>;
40
+ extensions: readonly string[] | Record<string, boolean>;
41
41
  };
42
42
  /**
43
43
  * Replace identifiers at build time.
@@ -1 +1 @@
1
- {"version":3,"file":"BundlerCapability.d.ts","sourceRoot":"","sources":["../src/BundlerCapability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,CAAC,OAAO,EAAE,QAAQ,SAAS,MAAM,GAAG,OAAO,IAAI,CAClF,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC;AAEb;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAC/B,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,MAAM,EAEvB,iBAAiB,SAAS,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAC7C;IACF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE;SACd,GAAG,IAAI,QAAQ,CAAC,CAAC,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;KAChF,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;;;;;;OAQG;IACH,cAAc,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAEnE;;;OAGG;IACH,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IAEF;;;;;;OAMG;IACH,OAAO,EACH,OAAO,GACP;QACE,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IAEN;;OAEG;IACH,KAAK,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IAEF;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,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AAE3E;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG,kCAAkC,GAAG,kCAAkC,CAAC;AAEjH;;;;GAIG;AACH,MAAM,MAAM,mCAAmC,GAAG;KAC/C,GAAG,IAAI,MAAM,2BAA2B,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC;CAC/G,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,wCAAwC,CAAC,OAAO,IAAI;KAC7D,GAAG,IAAI,MAAM,2BAA2B,GAAG,yBAAyB,CAAC,OAAO,EAAE,2BAA2B,CAAC,GAAG,CAAC,CAAC;CACjH,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,+BAA+B,CACzC,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,MAAM,EAEvB,iBAAiB,SAAS,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAC7C;IACF,OAAO,EAAE,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;CACvE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BundlerCapability.js","sourceRoot":"","sources":["../src/BundlerCapability.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppConfig } from './AppConfig.js';\n\n/**\n * A function that takes a config object and options object and returns a new config object.\n * This is used to implement a bundler capability.\n *\n * - `TConfig` is the type of the bundler's config object. (ie: `WebpackConfiguration`, `OriBuildOptions`, etc)\n * - `TOptions` is the type of the options object that's passed to the capability. (ie: `{ banner: string }`\n * or any other type that the capability needs when enabled) or a boolean to indicate if the capability is enabled.\n */\nexport type BundlerCapabilityFunction<TConfig, TOptions extends object | boolean> = (\n config: TConfig,\n options: TOptions,\n) => TConfig;\n\n/**\n * A bundler capability is a feature that can be enabled for a package to modify the bundling process.\n *\n * `TOptions` is the type of the options object that's passed to the capability. (ie: `{ banner: string }`\n * or any other type that the capability needs when enabled)\n */\nexport type BaseBundlerCapability<\n TOptions extends object,\n Bundlers extends string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n AllBundlerConfigs extends Record<Bundlers, any>,\n> = {\n name: string;\n description: string;\n implementations: {\n [key in Bundlers]?: BundlerCapabilityFunction<AllBundlerConfigs[key], TOptions>;\n };\n};\n\n/**\n * This is the list of the bundler capabilities that cloudpack provides.\n * - key: The name of the capability which will be used in the cloudpack config to enable the capability\n * - value: Options object which will be passed to the capability function\n */\nexport type InternalBundlerCapabilities = {\n /**\n * Inlines assets into the bundle.\n *\n * Extensions can be specified as:\n * - Array: `['avif']` - use only these extensions (replaces defaults)\n * - Object: `{ 'svg': false, 'avif': true }` - modify defaults (remove svg, add avif)\n *\n * Do not include the leading dot.\n */\n 'asset-inline': { extensions: string[] | Record<string, boolean> };\n\n /**\n * Replace identifiers at build time.\n * Values must be valid JS literals as strings (e.g. JSON.stringify('value')).\n */\n define: {\n [key: string]: string;\n };\n\n /**\n * Bundler capability to support Density externals.\n * This is not a real capability, it's just an indicator that a package needs to use density post-bundle task.\n * Since there is no actual way to execute post-bundle tasks, I'm using this as a workaround.\n * This will be removed once we have a proper way to execute post-bundle tasks with the plugins.\n * Options: List of entries that should be treated as density externals.\n */\n density:\n | boolean\n | {\n entries: string[];\n };\n\n /**\n * Adds aliases to externalized packages.\n */\n alias: {\n [key: string]: string;\n };\n\n /**\n * Enables React Native type resolution of .web.ts extensions.\n * Options: object is empty because it's just an indicator. No options are needed.\n */\n 'resolve-web-extensions': boolean;\n\n /**\n * Enables Relay support for the package.\n */\n relay: NonNullable<AppConfig['relay']>;\n};\n\n/**\n * This is the type that's being used `PackageSettings` to enable/disable bundler capabilities.\n * - Key: internal capability name\n * - Value: options object to configure the capability, or false to disable it\n */\nexport type InternalBundlerCapabilitiesOptions = {\n [key in keyof InternalBundlerCapabilities]?: InternalBundlerCapabilities[key] | boolean;\n};\n\ntype ExternalBundlerCapabilitiesOptions = Record<string, object | boolean>;\n\n/**\n * Options used in `PackageSettings` to configure or disable bundler capabilities.\n * - Key: capability name, either internal (Cloudpack-provided) or external (as specified in\n * `AppConfig.bundlerCapabilitiesRegistry`)\n * - Value: options object to configure the capability, or false to disable it.\n */\nexport type BundlerCapabilitiesOptions = InternalBundlerCapabilitiesOptions & ExternalBundlerCapabilitiesOptions;\n\n/**\n * Metadata for the bundler capabilities that cloudpack provides.\n * - Key: capability name\n * - Value: metadata object with description\n */\nexport type InternalBundlerCapabilitiesMetaData = {\n [key in keyof InternalBundlerCapabilities]: Pick<BaseBundlerCapability<object, string, object>, 'description'>;\n};\n\n/**\n * This is a bundler specific implementation of the internal bundler capabilities.\n * It's a mapping from the capability name to the capability function.\n *\n * `TConfig` is the type of the bundler's config object. (ie: `WebpackConfiguration`, `OriBuildOptions`, etc)\n */\nexport type InternalBundlerCapabilityImplementations<TConfig> = {\n [key in keyof InternalBundlerCapabilities]: BundlerCapabilityFunction<TConfig, InternalBundlerCapabilities[key]>;\n};\n\n/**\n * This is the type of the external bundler capability module that's being imported.\n *\n * `TOptions` is the type of the capability's options.\n */\nexport type ExternalBundlerCapabilityModule<\n TOptions extends object,\n Bundlers extends string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n AllBundlerConfigs extends Record<Bundlers, any>,\n> = {\n default: BaseBundlerCapability<TOptions, Bundlers, AllBundlerConfigs>;\n};\n"]}
1
+ {"version":3,"file":"BundlerCapability.js","sourceRoot":"","sources":["../src/BundlerCapability.ts"],"names":[],"mappings":"","sourcesContent":["import type { AppConfig } from './AppConfig.js';\n\n/**\n * A function that takes a config object and options object and returns a new config object.\n * This is used to implement a bundler capability.\n *\n * - `TConfig` is the type of the bundler's config object. (ie: `WebpackConfiguration`, `OriBuildOptions`, etc)\n * - `TOptions` is the type of the options object that's passed to the capability. (ie: `{ banner: string }`\n * or any other type that the capability needs when enabled) or a boolean to indicate if the capability is enabled.\n */\nexport type BundlerCapabilityFunction<TConfig, TOptions extends object | boolean> = (\n config: TConfig,\n options: TOptions,\n) => TConfig;\n\n/**\n * A bundler capability is a feature that can be enabled for a package to modify the bundling process.\n *\n * `TOptions` is the type of the options object that's passed to the capability. (ie: `{ banner: string }`\n * or any other type that the capability needs when enabled)\n */\nexport type BaseBundlerCapability<\n TOptions extends object,\n Bundlers extends string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n AllBundlerConfigs extends Record<Bundlers, any>,\n> = {\n name: string;\n description: string;\n implementations: {\n [key in Bundlers]?: BundlerCapabilityFunction<AllBundlerConfigs[key], TOptions>;\n };\n};\n\n/**\n * This is the list of the bundler capabilities that cloudpack provides.\n * - key: The name of the capability which will be used in the cloudpack config to enable the capability\n * - value: Options object which will be passed to the capability function\n */\nexport type InternalBundlerCapabilities = {\n /**\n * Inlines assets into the bundle.\n *\n * Extensions can be specified as:\n * - Array: `['avif']` - use only these extensions (replaces defaults)\n * - Object: `{ 'svg': false, 'avif': true }` - modify defaults (remove svg, add avif)\n *\n * Do not include the leading dot.\n */\n 'asset-inline': { extensions: readonly string[] | Record<string, boolean> };\n\n /**\n * Replace identifiers at build time.\n * Values must be valid JS literals as strings (e.g. JSON.stringify('value')).\n */\n define: {\n [key: string]: string;\n };\n\n /**\n * Bundler capability to support Density externals.\n * This is not a real capability, it's just an indicator that a package needs to use density post-bundle task.\n * Since there is no actual way to execute post-bundle tasks, I'm using this as a workaround.\n * This will be removed once we have a proper way to execute post-bundle tasks with the plugins.\n * Options: List of entries that should be treated as density externals.\n */\n density:\n | boolean\n | {\n entries: string[];\n };\n\n /**\n * Adds aliases to externalized packages.\n */\n alias: {\n [key: string]: string;\n };\n\n /**\n * Enables React Native type resolution of .web.ts extensions.\n * Options: object is empty because it's just an indicator. No options are needed.\n */\n 'resolve-web-extensions': boolean;\n\n /**\n * Enables Relay support for the package.\n */\n relay: NonNullable<AppConfig['relay']>;\n};\n\n/**\n * This is the type that's being used `PackageSettings` to enable/disable bundler capabilities.\n * - Key: internal capability name\n * - Value: options object to configure the capability, or false to disable it\n */\nexport type InternalBundlerCapabilitiesOptions = {\n [key in keyof InternalBundlerCapabilities]?: InternalBundlerCapabilities[key] | boolean;\n};\n\ntype ExternalBundlerCapabilitiesOptions = Record<string, object | boolean>;\n\n/**\n * Options used in `PackageSettings` to configure or disable bundler capabilities.\n * - Key: capability name, either internal (Cloudpack-provided) or external (as specified in\n * `AppConfig.bundlerCapabilitiesRegistry`)\n * - Value: options object to configure the capability, or false to disable it.\n */\nexport type BundlerCapabilitiesOptions = InternalBundlerCapabilitiesOptions & ExternalBundlerCapabilitiesOptions;\n\n/**\n * Metadata for the bundler capabilities that cloudpack provides.\n * - Key: capability name\n * - Value: metadata object with description\n */\nexport type InternalBundlerCapabilitiesMetaData = {\n [key in keyof InternalBundlerCapabilities]: Pick<BaseBundlerCapability<object, string, object>, 'description'>;\n};\n\n/**\n * This is a bundler specific implementation of the internal bundler capabilities.\n * It's a mapping from the capability name to the capability function.\n *\n * `TConfig` is the type of the bundler's config object. (ie: `WebpackConfiguration`, `OriBuildOptions`, etc)\n */\nexport type InternalBundlerCapabilityImplementations<TConfig> = {\n [key in keyof InternalBundlerCapabilities]: BundlerCapabilityFunction<TConfig, InternalBundlerCapabilities[key]>;\n};\n\n/**\n * This is the type of the external bundler capability module that's being imported.\n *\n * `TOptions` is the type of the capability's options.\n */\nexport type ExternalBundlerCapabilityModule<\n TOptions extends object,\n Bundlers extends string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n AllBundlerConfigs extends Record<Bundlers, any>,\n> = {\n default: BaseBundlerCapability<TOptions, Bundlers, AllBundlerConfigs>;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/common-types",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "Common types for Cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",