@granite-js/mpack 0.1.6 → 0.1.8

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 (104) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/bundler/Bundler.d.ts +1 -1
  3. package/dist/bundler/Bundler.js +7 -2
  4. package/dist/bundler/internal/presets.d.ts +19 -0
  5. package/dist/bundler/internal/presets.js +103 -0
  6. package/dist/bundler/plugins/buildStatusPlugin/buildStatusPlugin.d.ts +2 -2
  7. package/dist/bundler/plugins/buildStatusPlugin/buildStatusPlugin.js +4 -5
  8. package/dist/bundler/plugins/dependencyAliasPlugin/aliasResolver.d.ts +1 -1
  9. package/dist/bundler/plugins/dependencyAliasPlugin/protocolResolver.d.ts +1 -1
  10. package/dist/bundler/plugins/shared/swc.d.ts +1 -1
  11. package/dist/bundler/plugins/transformPlugin/steps/createTransformToHermesSyntaxStep.d.ts +1 -1
  12. package/dist/constants/index.d.ts +2 -2
  13. package/dist/constants/index.js +4 -4
  14. package/dist/index.d.ts +3 -8
  15. package/dist/index.js +9 -15
  16. package/dist/metro/build.d.ts +17 -0
  17. package/dist/metro/build.js +104 -0
  18. package/dist/metro/getMetroConfig.d.ts +2 -9
  19. package/dist/metro/getMetroConfig.js +4 -6
  20. package/dist/metro/index.d.ts +1 -2
  21. package/dist/metro/index.js +20 -3
  22. package/dist/operations/build.d.ts +15 -0
  23. package/dist/operations/{runBundle.js → build.js} +51 -51
  24. package/dist/operations/createDebuggerMiddleware.d.ts +1 -2
  25. package/dist/operations/createDebuggerMiddleware.js +4 -4
  26. package/dist/operations/experimental/serve.d.ts +11 -0
  27. package/dist/operations/experimental/{runServer.js → serve.js} +21 -25
  28. package/dist/operations/index.d.ts +3 -3
  29. package/dist/operations/index.js +23 -6
  30. package/dist/operations/openDebugger.d.ts +1 -1
  31. package/dist/operations/openDebugger.js +3 -2
  32. package/dist/operations/serve.d.ts +10 -0
  33. package/dist/operations/{runServer.js → serve.js} +15 -16
  34. package/dist/plugins/statusPlugin.js +1 -1
  35. package/dist/server/DevServer.d.ts +3 -0
  36. package/dist/server/DevServer.js +13 -14
  37. package/dist/server/helpers/createBundlerForDevServer.d.ts +3 -5
  38. package/dist/server/helpers/createBundlerForDevServer.js +10 -37
  39. package/dist/server/helpers/mergeBundles.d.ts +4 -4
  40. package/dist/server/helpers/mergeBundles.js +10 -10
  41. package/dist/server/plugins/serveBundlePlugin.d.ts +2 -2
  42. package/dist/server/plugins/symbolicatePlugin/symbolicatePlugin.d.ts +2 -2
  43. package/dist/server/types.d.ts +9 -14
  44. package/dist/types/BundlerConfig.d.ts +1 -34
  45. package/dist/types/Id.d.ts +3 -0
  46. package/dist/{bundler/types.js → types/Id.js} +2 -2
  47. package/dist/types/Plugin.d.ts +2 -2
  48. package/dist/types/index.d.ts +1 -7
  49. package/dist/types/index.js +2 -14
  50. package/dist/utils/getId.js +1 -8
  51. package/dist/utils/progressBar.d.ts +1 -1
  52. package/dist/utils/writeBundle.d.ts +1 -1
  53. package/dist/vendors/metro/src/lib/ReportableEvent.d.ts +152 -0
  54. package/dist/vendors/metro/src/lib/TerminalReporter.d.ts +2 -2
  55. package/dist/vendors/metro-transform-worker/src/index.js +0 -1
  56. package/package.json +5 -4
  57. package/dist/bundler/types.d.ts +0 -17
  58. package/dist/metro/runBuild.d.ts +0 -12
  59. package/dist/metro/runBuild.js +0 -66
  60. package/dist/metro/runtime.d.ts +0 -3
  61. package/dist/metro/runtime.js +0 -56
  62. package/dist/metro/types.d.ts +0 -88
  63. package/dist/metro/types.js +0 -16
  64. package/dist/operations/experimental/runServer.d.ts +0 -16
  65. package/dist/operations/runBundle.d.ts +0 -12
  66. package/dist/operations/runServer.d.ts +0 -15
  67. package/dist/types/BuildConfig.d.ts +0 -183
  68. package/dist/types/BuildConfig.js +0 -16
  69. package/dist/types/Config.d.ts +0 -12
  70. package/dist/types/Config.js +0 -16
  71. package/dist/types/DevServerConfig.d.ts +0 -9
  72. package/dist/types/DevServerConfig.js +0 -16
  73. package/dist/types/Preset.d.ts +0 -3
  74. package/dist/types/Preset.js +0 -16
  75. package/dist/types/PresetContext.d.ts +0 -2
  76. package/dist/types/PresetContext.js +0 -16
  77. package/dist/types/ServicesConfig.d.ts +0 -2
  78. package/dist/types/ServicesConfig.js +0 -16
  79. package/dist/types/TaskConfig.d.ts +0 -16
  80. package/dist/types/TaskConfig.js +0 -16
  81. package/dist/types/schemas/buildConfigSchema.d.ts +0 -235
  82. package/dist/types/schemas/buildConfigSchema.js +0 -79
  83. package/dist/types/schemas/bundlerConfigSchema.d.ts +0 -3
  84. package/dist/types/schemas/bundlerConfigSchema.js +0 -51
  85. package/dist/types/schemas/configSchema.d.ts +0 -3
  86. package/dist/types/schemas/configSchema.js +0 -50
  87. package/dist/types/schemas/devServerConfigSchema.d.ts +0 -3
  88. package/dist/types/schemas/devServerConfigSchema.js +0 -43
  89. package/dist/types/schemas/index.d.ts +0 -6
  90. package/dist/types/schemas/index.js +0 -32
  91. package/dist/types/schemas/servicesConfigSchema.d.ts +0 -3
  92. package/dist/types/schemas/servicesConfigSchema.js +0 -48
  93. package/dist/types/schemas/taskConfigSchema.d.ts +0 -3
  94. package/dist/types/schemas/taskConfigSchema.js +0 -45
  95. package/dist/utils/loadConfig.d.ts +0 -2
  96. package/dist/utils/loadConfig.js +0 -37
  97. package/dist/utils/loadPresets.d.ts +0 -2
  98. package/dist/utils/loadPresets.js +0 -40
  99. package/dist/utils/mergeBanners.d.ts +0 -6
  100. package/dist/utils/mergeBanners.js +0 -35
  101. package/dist/utils/mergeBuildConfigs.d.ts +0 -2
  102. package/dist/utils/mergeBuildConfigs.js +0 -59
  103. package/dist/utils/mergeInject.d.ts +0 -3
  104. package/dist/utils/mergeInject.js +0 -30
@@ -37,18 +37,18 @@ var import_getBundleName = require("../../utils/getBundleName");
37
37
  var import_getSourcemapName = require("../../utils/getSourcemapName");
38
38
  var import_constants2 = require("../constants");
39
39
  const INTERNAL_SOURCE = "mpack:internal";
40
- const IMPORT_SOURCE = "mpack:main-bundle";
40
+ const IMPORT_SOURCE = "mpack:remote";
41
41
  async function mergeBundles({
42
42
  platform,
43
- preloadedBundleContent,
44
- mainBundle
43
+ hostBundleContent,
44
+ remoteBundleContent
45
45
  }) {
46
46
  const bundleName = (0, import_getBundleName.getBundleName)(import_constants2.DEV_SERVER_BUNDLE_NAME);
47
47
  const sourcemapName = (0, import_getSourcemapName.getSourcemapName)(bundleName);
48
48
  const result = await esbuild.build({
49
49
  logLevel: "silent",
50
50
  stdin: {
51
- contents: [`require('${INTERNAL_SOURCE}');`, preloadedBundleContent].join("\n"),
51
+ contents: [`require('${INTERNAL_SOURCE}');`, hostBundleContent].join("\n"),
52
52
  loader: "js"
53
53
  },
54
54
  outfile: bundleName,
@@ -78,21 +78,21 @@ async function mergeBundles({
78
78
  },
79
79
  plugins: [
80
80
  {
81
- name: "main-bundle-loader",
81
+ name: "remote-bundle-loader",
82
82
  setup(build) {
83
83
  build.onResolve({ filter: new RegExp(`^${INTERNAL_SOURCE}$`) }, () => ({
84
84
  path: "dev-server-runtime",
85
85
  namespace: "DEV_SERVER_RUNTIME"
86
86
  }));
87
87
  build.onResolve({ filter: new RegExp(`^${IMPORT_SOURCE}$`) }, () => ({
88
- path: "main-bundle",
89
- namespace: "MAIN_BUNDLE"
88
+ path: "remote-bundle",
89
+ namespace: "REMOTE_BUNDLE"
90
90
  }));
91
91
  build.onLoad({ filter: /.*/, namespace: "DEV_SERVER_RUNTIME" }, () => ({
92
92
  contents: `
93
93
  (function(global) {
94
94
  global.${import_constants.INTERNAL_NAMESPACE_IDENTIFIER} = {};
95
- global.${import_constants.INTERNAL_NAMESPACE_IDENTIFIER}.${import_constants.INTERNAL_EVALUATE_MAIN_BUNDLE_IDENTIFIER} = function INTERNAL__evaluateMainBundle() {
95
+ global.${import_constants.INTERNAL_NAMESPACE_IDENTIFIER}.${import_constants.INTERNAL_LOAD_REMOTE_IDENTIFIER} = function INTERNAL__loadRemote() {
96
96
  require('${IMPORT_SOURCE}');
97
97
  return Promise.resolve();
98
98
  }
@@ -108,8 +108,8 @@ async function mergeBundles({
108
108
  `,
109
109
  loader: "js"
110
110
  }));
111
- build.onLoad({ filter: /.*/, namespace: "MAIN_BUNDLE" }, () => ({
112
- contents: mainBundle.source.text,
111
+ build.onLoad({ filter: /.*/, namespace: "REMOTE_BUNDLE" }, () => ({
112
+ contents: remoteBundleContent,
113
113
  loader: "js"
114
114
  }));
115
115
  }
@@ -1,5 +1,5 @@
1
- import { FastifyInstance } from 'fastify';
2
- import { BundleData } from '../../bundler/types';
1
+ import type { BundleData } from '@granite-js/plugin-core';
2
+ import type { FastifyInstance } from 'fastify';
3
3
  import type { Platform } from '../types';
4
4
  declare function _serveBundlePlugin(app: FastifyInstance, { getBundle }: {
5
5
  getBundle: (platform: Platform) => Promise<BundleData>;
@@ -1,5 +1,5 @@
1
- import { FastifyInstance } from 'fastify';
2
- import { BundleData } from '../../../bundler/types';
1
+ import type { BundleData } from '@granite-js/plugin-core';
2
+ import type { FastifyInstance } from 'fastify';
3
3
  import type { Platform } from '../../types';
4
4
  declare function symbolicatePluginImpl(app: FastifyInstance, { getBundle }: {
5
5
  getBundle: (platform: Platform) => Promise<BundleData>;
@@ -1,20 +1,16 @@
1
- import type { FastifyPluginAsync, FastifyPluginCallback } from 'fastify';
1
+ import type { Middleware, BuildConfig } from '@granite-js/plugin-core';
2
2
  import type { Bundler } from '../bundler';
3
- import type { DevServerConfig } from '../types';
4
3
  import type { BuildStatusProgressBar } from '../utils/progressBar';
5
4
  export type Platform = 'android' | 'ios';
6
- export interface DevServerOptions extends DevServerConfig {
5
+ export interface DevServerOptions {
7
6
  rootDir: string;
8
- appName: string;
9
- scheme: string;
10
- preloadBundle?: string;
11
7
  host?: string;
12
8
  port?: number;
13
- plugins?: DevServerPlugin[];
9
+ buildConfig: Omit<BuildConfig, 'platform' | 'outfile'>;
10
+ middlewares?: Middleware[];
14
11
  }
15
12
  export interface DevServerContext {
16
13
  rootDir: string;
17
- config: DevServerConfig;
18
14
  android: {
19
15
  bundler: Bundler;
20
16
  progressBar: BuildStatusProgressBar;
@@ -24,14 +20,14 @@ export interface DevServerContext {
24
20
  progressBar: BuildStatusProgressBar;
25
21
  };
26
22
  }
27
- type ClientLogLevel = 'trace' | 'info' | 'warn'
23
+ type ClientLogLevel = 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug'
28
24
  /**
29
- * React Native 에는 ReportableEvent['level'] 에 `error` 타입이 정의되어있지 않은데,
30
- * Flipper 에서는 error 타입을 지원하기에 이를 추가함.
25
+ * In React Native, `error` type is not defined in ReportableEvent['level'],
26
+ * Flipper supports `error` type, so we add it.
31
27
  *
32
28
  * @see {@link https://github.com/facebook/flipper/blob/v0.211.0/desktop/flipper-common/src/server-types.tsx#L76}
33
29
  */
34
- | 'error' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';
30
+ | 'error';
35
31
  /**
36
32
  * @see {@link https://github.com/facebook/metro/blob/v0.78.0/packages/metro/src/lib/reporting.js#L36}
37
33
  */
@@ -42,7 +38,7 @@ export interface ClientLogEvent {
42
38
  mode: 'BRIDGE' | 'NOBRIDGE';
43
39
  }
44
40
  /**
45
- * HMR 웹소켓 메시지 타입
41
+ * HMR WebSocket message type
46
42
  *
47
43
  * @see {@link https://github.com/facebook/metro/blob/v0.77.0/packages/metro-runtime/src/modules/types.flow.js#L68}
48
44
  */
@@ -93,5 +89,4 @@ export type BroadcastCommand = 'reload' | 'devMenu';
93
89
  export interface MessageBroadcaster {
94
90
  (command: BroadcastCommand, params?: Record<string, unknown>): void;
95
91
  }
96
- export type DevServerPlugin = FastifyPluginCallback | FastifyPluginAsync;
97
92
  export {};
@@ -1,21 +1,9 @@
1
- import { BuildConfig } from './BuildConfig';
1
+ import type { BuildConfig } from '@granite-js/plugin-core';
2
2
  export interface BundlerConfig {
3
- /**
4
- * Task indentifier
5
- */
6
- tag: string;
7
3
  /**
8
4
  * Project root path
9
5
  */
10
6
  rootDir: string;
11
- /**
12
- * Application name
13
- */
14
- appName: string;
15
- /**
16
- * Scheme prefix
17
- */
18
- scheme: string;
19
7
  /**
20
8
  * Development mode
21
9
  */
@@ -32,25 +20,4 @@ export interface BundlerConfig {
32
20
  * Build configuration
33
21
  */
34
22
  buildConfig: BuildConfig;
35
- /**
36
- * @deprecated
37
- *
38
- * Configuration for integrating external services
39
- */
40
- services?: ServiceConfig;
41
- }
42
- interface ServiceConfig {
43
- sentry?: {
44
- /**
45
- * Defaults to `true`
46
- */
47
- enabled?: boolean;
48
- /**
49
- * Defaults to `process.env.SENTRY_AUTH_TOKEN`
50
- */
51
- authToken?: string;
52
- org?: string;
53
- project?: string;
54
- };
55
23
  }
56
- export {};
@@ -0,0 +1,3 @@
1
+ export type INTERNAL__Id = string & {
2
+ __id: true;
3
+ };
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
15
+ var Id_exports = {};
16
+ module.exports = __toCommonJS(Id_exports);
@@ -1,5 +1,5 @@
1
- import type { INTERNAL__Id } from './TaskConfig';
2
- import type { BuildResult } from '../bundler/types';
1
+ import type { BuildResult } from '@granite-js/plugin-core';
2
+ import type { INTERNAL__Id } from './Id';
3
3
  import type { BundlerConfig } from '../types/BundlerConfig';
4
4
  export interface Plugin extends Partial<BindThis<PluginHooks, PluginContext>> {
5
5
  name?: string;
@@ -1,9 +1,3 @@
1
- export * from './BuildConfig';
2
1
  export * from './BundlerConfig';
3
- export * from './Config';
4
- export * from './DevServerConfig';
5
2
  export * from './Plugin';
6
- export * from './PresetContext';
7
- export * from './ServicesConfig';
8
- export * from './TaskConfig';
9
- export * from './Preset';
3
+ export * from './Id';
@@ -15,24 +15,12 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var types_exports = {};
17
17
  module.exports = __toCommonJS(types_exports);
18
- __reExport(types_exports, require("./BuildConfig"), module.exports);
19
18
  __reExport(types_exports, require("./BundlerConfig"), module.exports);
20
- __reExport(types_exports, require("./Config"), module.exports);
21
- __reExport(types_exports, require("./DevServerConfig"), module.exports);
22
19
  __reExport(types_exports, require("./Plugin"), module.exports);
23
- __reExport(types_exports, require("./PresetContext"), module.exports);
24
- __reExport(types_exports, require("./ServicesConfig"), module.exports);
25
- __reExport(types_exports, require("./TaskConfig"), module.exports);
26
- __reExport(types_exports, require("./Preset"), module.exports);
20
+ __reExport(types_exports, require("./Id"), module.exports);
27
21
  // Annotate the CommonJS export names for ESM import in node:
28
22
  0 && (module.exports = {
29
- ...require("./BuildConfig"),
30
23
  ...require("./BundlerConfig"),
31
- ...require("./Config"),
32
- ...require("./DevServerConfig"),
33
24
  ...require("./Plugin"),
34
- ...require("./PresetContext"),
35
- ...require("./ServicesConfig"),
36
- ...require("./TaskConfig"),
37
- ...require("./Preset")
25
+ ...require("./Id")
38
26
  });
@@ -25,14 +25,7 @@ var import_md5 = require("./md5");
25
25
  var import_constants = require("../constants");
26
26
  function getId(bundleConfig) {
27
27
  return (0, import_md5.md5)(
28
- JSON.stringify([
29
- import_constants.VERSION,
30
- bundleConfig.appName,
31
- bundleConfig.rootDir,
32
- bundleConfig.dev,
33
- bundleConfig.services,
34
- bundleConfig.buildConfig
35
- ])
28
+ JSON.stringify([import_constants.VERSION, bundleConfig.rootDir, bundleConfig.dev, bundleConfig.buildConfig])
36
29
  );
37
30
  }
38
31
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,4 +1,4 @@
1
- import type { BuildResult } from '../bundler/types';
1
+ import type { BuildResult } from '@granite-js/plugin-core';
2
2
  export interface BuildStatusProgressBar {
3
3
  start: (moduleCount: number, totalModuleCount: number) => void;
4
4
  update: (moduleCount: number, totalModuleCount?: number) => void;
@@ -1,2 +1,2 @@
1
- import type { BundleData } from '../bundler/types';
1
+ import type { BundleData } from '@granite-js/plugin-core';
2
2
  export declare function writeBundle(outputPath: string, { source, sourcemap }: BundleData): Promise<void>;
@@ -0,0 +1,152 @@
1
+ interface BundleDetails {
2
+ bundleType: string;
3
+ dev: boolean;
4
+ entryFile: string;
5
+ minify: boolean;
6
+ platform?: string;
7
+ runtimeBytecodeVersion?: number;
8
+ }
9
+
10
+ type WatcherStatus =
11
+ | {
12
+ type: 'watchman_slow_command';
13
+ timeElapsed: number;
14
+ command: 'watch-project' | 'query';
15
+ }
16
+ | {
17
+ type: 'watchman_slow_command_complete';
18
+ timeElapsed: number;
19
+ command: 'watch-project' | 'query';
20
+ }
21
+ | {
22
+ type: 'watchman_warning';
23
+ warning: unknown;
24
+ command: 'watch-project' | 'query';
25
+ };
26
+
27
+ type HealthCheckResult =
28
+ | {type: 'error'; timeout: number; error: Error; watcher: string | null}
29
+ | {
30
+ type: 'success';
31
+ timeout: number;
32
+ timeElapsed: number;
33
+ watcher: string | null;
34
+ }
35
+ | {
36
+ type: 'timeout';
37
+ timeout: number;
38
+ watcher: string | null;
39
+ pauseReason: string | null;
40
+ };
41
+
42
+ export type ReportableEvent =
43
+ | {
44
+ port: number;
45
+ hasReducedPerformance: boolean;
46
+ type: 'initialize_started';
47
+ }
48
+ | {
49
+ type: 'initialize_failed';
50
+ port: number;
51
+ error: Error;
52
+ }
53
+ | {
54
+ type: 'initialize_done';
55
+ port: number;
56
+ }
57
+ | {
58
+ buildID: string;
59
+ type: 'bundle_build_done';
60
+ }
61
+ | {
62
+ buildID: string;
63
+ type: 'bundle_build_failed';
64
+ }
65
+ | {
66
+ type: 'bundle_save_log';
67
+ message: string;
68
+ }
69
+ | {
70
+ buildID: string;
71
+ bundleDetails: BundleDetails;
72
+ isPrefetch?: boolean;
73
+ type: 'bundle_build_started';
74
+ }
75
+ | {
76
+ error: Error;
77
+ type: 'bundling_error';
78
+ }
79
+ | {
80
+ type: 'dep_graph_loading';
81
+ hasReducedPerformance: boolean;
82
+ }
83
+ | {type: 'dep_graph_loaded'}
84
+ | {
85
+ buildID: string;
86
+ type: 'bundle_transform_progressed';
87
+ transformedFileCount: number;
88
+ totalFileCount: number;
89
+ }
90
+ | {
91
+ type: 'cache_read_error';
92
+ error: Error;
93
+ }
94
+ | {
95
+ type: 'cache_write_error';
96
+ error: Error;
97
+ }
98
+ | {type: 'transform_cache_reset'}
99
+ | {
100
+ type: 'worker_stdout_chunk';
101
+ chunk: string;
102
+ }
103
+ | {
104
+ type: 'worker_stderr_chunk';
105
+ chunk: string;
106
+ }
107
+ | {
108
+ type: 'hmr_client_error';
109
+ error: Error;
110
+ }
111
+ | {
112
+ type: 'client_log';
113
+ level:
114
+ | 'trace'
115
+ | 'info'
116
+ | 'warn'
117
+ | 'log'
118
+ | 'group'
119
+ | 'groupCollapsed'
120
+ | 'groupEnd'
121
+ | 'debug';
122
+ data: Array<unknown>;
123
+ mode: 'BRIDGE' | 'NOBRIDGE';
124
+ }
125
+ | {
126
+ type: 'resolver_warning';
127
+ message: string;
128
+ }
129
+ | {
130
+ type: 'server_listening';
131
+ port: number;
132
+ address: string;
133
+ family: string;
134
+ }
135
+ | {
136
+ type: 'transformer_load_started';
137
+ }
138
+ | {
139
+ type: 'transformer_load_done';
140
+ }
141
+ | {
142
+ type: 'transformer_load_failed';
143
+ error: Error;
144
+ }
145
+ | {
146
+ type: 'watcher_health_check_result';
147
+ result: HealthCheckResult;
148
+ }
149
+ | {
150
+ type: 'watcher_status';
151
+ status: WatcherStatus;
152
+ };
@@ -1,5 +1,5 @@
1
+ import type { ReportableEvent } from "./ReportableEvent";
1
2
  type Terminal = any;
2
- type ReportableEvent = any;
3
3
  type TerminalReportableEvent =
4
4
  | ReportableEvent
5
5
  | {
@@ -15,4 +15,4 @@ declare class TerminalReporter {
15
15
  update(event: TerminalReportableEvent): void;
16
16
  }
17
17
 
18
- export default TerminalReporter;
18
+ export default TerminalReporter;
@@ -359,7 +359,6 @@ function getBabelTransformArgs(file, { options, config, projectRoot }) {
359
359
  // MARK: - GRANITE
360
360
  ...additionalBabelConfig,
361
361
  plugins: additionalBabelConfig?.plugins ?? [],
362
- filename: file.filename,
363
362
  src: file.code
364
363
  };
365
364
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granite-js/mpack",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A bundler for Granite apps",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -83,8 +83,9 @@
83
83
  "@babel/traverse": "^7.14.0",
84
84
  "@babel/types": "^7.0.0",
85
85
  "@fastify/static": "7.0.1",
86
- "@granite-js/devtools-frontend": "0.1.6",
87
- "@granite-js/utils": "0.1.6",
86
+ "@granite-js/devtools-frontend": "0.1.8",
87
+ "@granite-js/plugin-core": "0.1.8",
88
+ "@granite-js/utils": "0.1.8",
88
89
  "@inquirer/prompts": "^7.2.3",
89
90
  "@react-native-community/cli-plugin-metro": "11.3.7",
90
91
  "@react-native-community/cli-server-api": "11.3.7",
@@ -110,7 +111,7 @@
110
111
  "enhanced-resolve": "^5.17.1",
111
112
  "error-stack-parser": "^2.0.6",
112
113
  "es-toolkit": "^1.26.1",
113
- "esbuild": "^0.25.4",
114
+ "esbuild": "0.25.8",
114
115
  "events": "3.3.0",
115
116
  "fastify": "4.14.0",
116
117
  "fastify-plugin": "4.5.1",
@@ -1,17 +0,0 @@
1
- import * as esbuild from 'esbuild';
2
- import type { BuildConfig } from '..';
3
- export type BuildResult = esbuild.BuildResult & {
4
- tag: string;
5
- bundle: BundleData;
6
- outfile: BuildConfig['outfile'];
7
- sourcemapOutfile: NonNullable<BuildConfig['sourcemapOutfile']>;
8
- platform: BuildConfig['platform'];
9
- extra: BuildConfig['extra'];
10
- totalModuleCount: number;
11
- duration: number;
12
- size: number;
13
- };
14
- export interface BundleData {
15
- source: esbuild.OutputFile;
16
- sourcemap: esbuild.OutputFile;
17
- }
@@ -1,12 +0,0 @@
1
- import type { MetroConfig } from './types';
2
- export declare function runBuild({ appName, scheme, rootPath, entry, platform, minify, out, dev, additionalConfig, }: {
3
- appName: string;
4
- scheme: string;
5
- rootPath: string;
6
- entry: string;
7
- platform: 'ios' | 'android';
8
- minify: boolean;
9
- out: string;
10
- dev: boolean;
11
- additionalConfig?: MetroConfig;
12
- }): Promise<void>;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var runBuild_exports = {};
30
- __export(runBuild_exports, {
31
- runBuild: () => runBuild
32
- });
33
- module.exports = __toCommonJS(runBuild_exports);
34
- var import_getMetroConfig = require("./getMetroConfig");
35
- var import_src = __toESM(require("../vendors/metro/src"));
36
- async function runBuild({
37
- appName,
38
- scheme,
39
- rootPath,
40
- entry,
41
- platform,
42
- minify,
43
- out,
44
- dev,
45
- additionalConfig
46
- }) {
47
- const config = await (0, import_getMetroConfig.getMetroConfig)(
48
- {
49
- appName,
50
- rootPath,
51
- scheme
52
- },
53
- additionalConfig
54
- );
55
- await import_src.default.runBuild(config, {
56
- entry,
57
- platform,
58
- minify,
59
- out,
60
- dev
61
- });
62
- }
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- runBuild
66
- });
@@ -1,3 +0,0 @@
1
- export declare function writeEnvScript(rootPath: string, appName: string, scheme: string): Promise<{
2
- path: string;
3
- }>;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var runtime_exports = {};
30
- __export(runtime_exports, {
31
- writeEnvScript: () => writeEnvScript
32
- });
33
- module.exports = __toCommonJS(runtime_exports);
34
- var import_promises = __toESM(require("fs/promises"));
35
- var import_path = __toESM(require("path"));
36
- async function writeEnvScript(rootPath, appName, scheme) {
37
- const script = getEnvScript(appName, scheme);
38
- const basePath = import_path.default.join(rootPath, ".granite");
39
- const filePath = import_path.default.join(basePath, ".env.js");
40
- await import_promises.default.access(basePath).catch(() => import_promises.default.mkdir(basePath));
41
- await import_promises.default.writeFile(filePath, script, { encoding: "utf-8" });
42
- return { path: filePath };
43
- }
44
- function getEnvScript(appName, scheme) {
45
- const buildNumber = "00000000";
46
- const script = [
47
- "global.__granite = global.__granite || {};",
48
- `global.__granite.shared = { buildNumber: ${JSON.stringify(buildNumber)} };`,
49
- `global.__granite.app = { name: ${appName.startsWith("babel:") ? appName.slice(6) : JSON.stringify(appName)}, scheme: ${JSON.stringify(scheme)}, buildNumber: ${JSON.stringify(buildNumber)} };`
50
- ].join("\n");
51
- return script;
52
- }
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- writeEnvScript
56
- });