@ptkl/toolkit 0.10.1 → 0.10.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.
@@ -132,9 +132,6 @@ class ForgeCommand {
132
132
  type: type || 'platform', // default to 'platform' if not specified
133
133
  ssrRenderer,
134
134
  };
135
- const client = Util.getClientForProfile();
136
- // get base url of the platform cliente
137
- const baseUrl = client.getPlatformBaseURL();
138
135
  // Different build approach for public vs platform apps
139
136
  if (type === 'public') {
140
137
  // Public apps: standard SPA build with index.html
@@ -194,13 +191,13 @@ class ForgeCommand {
194
191
  }
195
192
  else {
196
193
  // Platform apps: custom bundle format with views and scripts
197
- const base = `${baseUrl}/luma/appservice/v1/forge/static/bundle/${name}/${version}/`;
194
+ const bundleBasePath = `/luma/appservice/v1/forge/static/bundle/${name}/${version}/`;
198
195
  const buildViews = Object.keys(views).map(async (view) => {
199
196
  manifest.views[view] = `${view}.bundle.js`;
200
197
  try {
201
198
  const result = await build({
202
199
  root: path,
203
- base,
200
+ base: bundleBasePath,
204
201
  build: {
205
202
  outDir: distPath,
206
203
  emptyOutDir: false,
@@ -225,10 +222,12 @@ class ForgeCommand {
225
222
  for (const fileName in bundle) {
226
223
  const chunk = bundle[fileName];
227
224
  if (chunk.type === 'chunk' && chunk.code) {
225
+ const runtimeBaseResolver = `const __ptklForgeBundleBase=()=>{const env=typeof window!=='undefined'&&window.__ENV_VARIABLES__?window.__ENV_VARIABLES__.API_HOST:'';const host=typeof env==='string'?env.replace(/\\/$/,''):'';return host+'${bundleBasePath}';};\n`;
226
+ chunk.code = runtimeBaseResolver + chunk.code;
228
227
  // Transform dynamic imports in the final bundled code
229
- chunk.code = chunk.code.replace(/import\(['"`]\.\/([^'"`]+)['"`]\)/g, `dynamicImport('${base}$1')`);
228
+ chunk.code = chunk.code.replace(/import\(['"`]\.\/([^'"`]+)['"`]\)/g, `dynamicImport(__ptklForgeBundleBase() + '$1')`);
230
229
  // Also handle relative paths without ./
231
- chunk.code = chunk.code.replace(/import\(['"`]([^'"`\/]+\.js)['"`]\)/g, `dynamicImport('${base}$1')`);
230
+ chunk.code = chunk.code.replace(/import\(['"`]([^'"`\/]+\.js)['"`]\)/g, `dynamicImport(__ptklForgeBundleBase() + '$1')`);
232
231
  }
233
232
  }
234
233
  }
@@ -246,7 +245,7 @@ class ForgeCommand {
246
245
  try {
247
246
  const result = await build({
248
247
  root: path,
249
- base,
248
+ base: bundleBasePath,
250
249
  build: {
251
250
  outDir: distPath,
252
251
  emptyOutDir: false,
@@ -335,6 +334,7 @@ class ForgeCommand {
335
334
  const manifestPath = `${distPath}/manifest.json`;
336
335
  writeFileSync(manifestPath, JSON.stringify(manifest, null, 4));
337
336
  if (upload) {
337
+ const client = Util.getClientForProfile();
338
338
  let buffer = Buffer.alloc(0);
339
339
  const bufferStream = new Writable({
340
340
  write(chunk, encoding, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/toolkit",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "A command-line toolkit for managing Protokol platform applications, profiles, functions, and components",
5
5
  "keywords": [
6
6
  "protokol",