@locale-labs/miniapp-builder 0.1.9-dev.50.c6cffa5 → 0.1.9-dev.51.d1b5a55

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.
package/dist/index.js CHANGED
@@ -9104,9 +9104,9 @@ var require_rebase = __commonJS({
9104
9104
  // node_modules/clean-css/lib/options/rebase-to.js
9105
9105
  var require_rebase_to = __commonJS({
9106
9106
  "node_modules/clean-css/lib/options/rebase-to.js"(exports2, module2) {
9107
- var path4 = require("path");
9107
+ var path7 = require("path");
9108
9108
  function rebaseToFrom(option) {
9109
- return option ? path4.resolve(option) : process.cwd();
9109
+ return option ? path7.resolve(option) : process.cwd();
9110
9110
  }
9111
9111
  module2.exports = rebaseToFrom;
9112
9112
  }
@@ -9258,16 +9258,16 @@ var require_util = __commonJS({
9258
9258
  }
9259
9259
  exports2.urlGenerate = urlGenerate;
9260
9260
  function normalize(aPath) {
9261
- var path4 = aPath;
9261
+ var path7 = aPath;
9262
9262
  var url = urlParse(aPath);
9263
9263
  if (url) {
9264
9264
  if (!url.path) {
9265
9265
  return aPath;
9266
9266
  }
9267
- path4 = url.path;
9267
+ path7 = url.path;
9268
9268
  }
9269
- var isAbsolute = exports2.isAbsolute(path4);
9270
- var parts = path4.split(/\/+/);
9269
+ var isAbsolute = exports2.isAbsolute(path7);
9270
+ var parts = path7.split(/\/+/);
9271
9271
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
9272
9272
  part = parts[i];
9273
9273
  if (part === ".") {
@@ -9284,18 +9284,18 @@ var require_util = __commonJS({
9284
9284
  }
9285
9285
  }
9286
9286
  }
9287
- path4 = parts.join("/");
9288
- if (path4 === "") {
9289
- path4 = isAbsolute ? "/" : ".";
9287
+ path7 = parts.join("/");
9288
+ if (path7 === "") {
9289
+ path7 = isAbsolute ? "/" : ".";
9290
9290
  }
9291
9291
  if (url) {
9292
- url.path = path4;
9292
+ url.path = path7;
9293
9293
  return urlGenerate(url);
9294
9294
  }
9295
- return path4;
9295
+ return path7;
9296
9296
  }
9297
9297
  exports2.normalize = normalize;
9298
- function join5(aRoot, aPath) {
9298
+ function join8(aRoot, aPath) {
9299
9299
  if (aRoot === "") {
9300
9300
  aRoot = ".";
9301
9301
  }
@@ -9327,7 +9327,7 @@ var require_util = __commonJS({
9327
9327
  }
9328
9328
  return joined;
9329
9329
  }
9330
- exports2.join = join5;
9330
+ exports2.join = join8;
9331
9331
  exports2.isAbsolute = function(aPath) {
9332
9332
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
9333
9333
  };
@@ -9500,7 +9500,7 @@ var require_util = __commonJS({
9500
9500
  parsed.path = parsed.path.substring(0, index + 1);
9501
9501
  }
9502
9502
  }
9503
- sourceURL = join5(urlGenerate(parsed), sourceURL);
9503
+ sourceURL = join8(urlGenerate(parsed), sourceURL);
9504
9504
  }
9505
9505
  return normalize(sourceURL);
9506
9506
  }
@@ -10935,7 +10935,7 @@ var require_has_protocol = __commonJS({
10935
10935
  // node_modules/clean-css/lib/reader/is-allowed-resource.js
10936
10936
  var require_is_allowed_resource = __commonJS({
10937
10937
  "node_modules/clean-css/lib/reader/is-allowed-resource.js"(exports2, module2) {
10938
- var path4 = require("path");
10938
+ var path7 = require("path");
10939
10939
  var url = require("url");
10940
10940
  var isRemoteResource = require_is_remote_resource();
10941
10941
  var hasProtocol = require_has_protocol();
@@ -10955,7 +10955,7 @@ var require_is_allowed_resource = __commonJS({
10955
10955
  uri = HTTP_PROTOCOL + uri;
10956
10956
  }
10957
10957
  match = isRemote ? url.parse(uri).host : uri;
10958
- absoluteUri = isRemote ? uri : path4.resolve(uri);
10958
+ absoluteUri = isRemote ? uri : path7.resolve(uri);
10959
10959
  for (i = 0; i < rules.length; i++) {
10960
10960
  rule = rules[i];
10961
10961
  isNegated = rule[0] == "!";
@@ -10982,7 +10982,7 @@ var require_is_allowed_resource = __commonJS({
10982
10982
  allowed = true;
10983
10983
  } else if (isRemote && absoluteUri.indexOf(rule) === 0) {
10984
10984
  allowed = true;
10985
- } else if (!isRemote && absoluteUri.indexOf(path4.resolve(rule)) === 0) {
10985
+ } else if (!isRemote && absoluteUri.indexOf(path7.resolve(rule)) === 0) {
10986
10986
  allowed = true;
10987
10987
  } else if (isRemote != isRemoteRule(normalizedRule)) {
10988
10988
  allowed = allowed && true;
@@ -11013,13 +11013,13 @@ var require_match_data_uri = __commonJS({
11013
11013
  // node_modules/clean-css/lib/reader/rebase-local-map.js
11014
11014
  var require_rebase_local_map = __commonJS({
11015
11015
  "node_modules/clean-css/lib/reader/rebase-local-map.js"(exports2, module2) {
11016
- var path4 = require("path");
11016
+ var path7 = require("path");
11017
11017
  function rebaseLocalMap(sourceMap, sourceUri, rebaseTo) {
11018
- var currentPath = path4.resolve("");
11019
- var absoluteUri = path4.resolve(currentPath, sourceUri);
11020
- var absoluteUriDirectory = path4.dirname(absoluteUri);
11018
+ var currentPath = path7.resolve("");
11019
+ var absoluteUri = path7.resolve(currentPath, sourceUri);
11020
+ var absoluteUriDirectory = path7.dirname(absoluteUri);
11021
11021
  sourceMap.sources = sourceMap.sources.map(function(source) {
11022
- return path4.relative(rebaseTo, path4.resolve(absoluteUriDirectory, source));
11022
+ return path7.relative(rebaseTo, path7.resolve(absoluteUriDirectory, source));
11023
11023
  });
11024
11024
  return sourceMap;
11025
11025
  }
@@ -11030,10 +11030,10 @@ var require_rebase_local_map = __commonJS({
11030
11030
  // node_modules/clean-css/lib/reader/rebase-remote-map.js
11031
11031
  var require_rebase_remote_map = __commonJS({
11032
11032
  "node_modules/clean-css/lib/reader/rebase-remote-map.js"(exports2, module2) {
11033
- var path4 = require("path");
11033
+ var path7 = require("path");
11034
11034
  var url = require("url");
11035
11035
  function rebaseRemoteMap(sourceMap, sourceUri) {
11036
- var sourceDirectory = path4.dirname(sourceUri);
11036
+ var sourceDirectory = path7.dirname(sourceUri);
11037
11037
  sourceMap.sources = sourceMap.sources.map(function(source) {
11038
11038
  return url.resolve(sourceDirectory, source);
11039
11039
  });
@@ -11057,8 +11057,8 @@ var require_is_data_uri_resource = __commonJS({
11057
11057
  // node_modules/clean-css/lib/reader/apply-source-maps.js
11058
11058
  var require_apply_source_maps = __commonJS({
11059
11059
  "node_modules/clean-css/lib/reader/apply-source-maps.js"(exports2, module2) {
11060
- var fs6 = require("fs");
11061
- var path4 = require("path");
11060
+ var fs9 = require("fs");
11061
+ var path7 = require("path");
11062
11062
  var isAllowedResource = require_is_allowed_resource();
11063
11063
  var matchDataUri = require_match_data_uri();
11064
11064
  var rebaseLocalMap = require_rebase_local_map();
@@ -11148,7 +11148,7 @@ var require_apply_source_maps = __commonJS({
11148
11148
  }
11149
11149
  });
11150
11150
  }
11151
- absoluteUri = path4.resolve(applyContext.rebaseTo, uri);
11151
+ absoluteUri = path7.resolve(applyContext.rebaseTo, uri);
11152
11152
  sourceMap = loadInputSourceMapFromLocalUri(absoluteUri, applyContext);
11153
11153
  if (sourceMap) {
11154
11154
  rebasedMap = rebaseLocalMap(sourceMap, absoluteUri, applyContext.rebaseTo);
@@ -11191,7 +11191,7 @@ var require_apply_source_maps = __commonJS({
11191
11191
  function loadInputSourceMapFromLocalUri(uri, applyContext) {
11192
11192
  var isAllowed = isAllowedResource(uri, false, applyContext.inline);
11193
11193
  var sourceMap;
11194
- if (!fs6.existsSync(uri) || !fs6.statSync(uri).isFile()) {
11194
+ if (!fs9.existsSync(uri) || !fs9.statSync(uri).isFile()) {
11195
11195
  applyContext.warnings.push('Ignoring local source map at "' + uri + '" as resource is missing.');
11196
11196
  return null;
11197
11197
  }
@@ -11199,11 +11199,11 @@ var require_apply_source_maps = __commonJS({
11199
11199
  applyContext.warnings.push('Cannot fetch "' + uri + '" as resource is not allowed.');
11200
11200
  return null;
11201
11201
  }
11202
- if (!fs6.statSync(uri).size) {
11202
+ if (!fs9.statSync(uri).size) {
11203
11203
  applyContext.warnings.push('Cannot fetch "' + uri + '" as resource is empty.');
11204
11204
  return null;
11205
11205
  }
11206
- sourceMap = fs6.readFileSync(uri, "utf-8");
11206
+ sourceMap = fs9.readFileSync(uri, "utf-8");
11207
11207
  return JSON.parse(sourceMap);
11208
11208
  }
11209
11209
  function applySourceMapRecursively(tokens, inputSourceMapTracker) {
@@ -11297,8 +11297,8 @@ var require_extract_import_url_and_media = __commonJS({
11297
11297
  // node_modules/clean-css/lib/reader/load-original-sources.js
11298
11298
  var require_load_original_sources = __commonJS({
11299
11299
  "node_modules/clean-css/lib/reader/load-original-sources.js"(exports2, module2) {
11300
- var fs6 = require("fs");
11301
- var path4 = require("path");
11300
+ var fs9 = require("fs");
11301
+ var path7 = require("path");
11302
11302
  var isAllowedResource = require_is_allowed_resource();
11303
11303
  var hasProtocol = require_has_protocol();
11304
11304
  var isRemoteResource = require_is_remote_resource();
@@ -11388,8 +11388,8 @@ var require_load_original_sources = __commonJS({
11388
11388
  }
11389
11389
  function loadOriginalSourceFromLocalUri(relativeUri, loadContext) {
11390
11390
  var isAllowed = isAllowedResource(relativeUri, false, loadContext.inline);
11391
- var absoluteUri = path4.resolve(loadContext.rebaseTo, relativeUri);
11392
- if (!fs6.existsSync(absoluteUri) || !fs6.statSync(absoluteUri).isFile()) {
11391
+ var absoluteUri = path7.resolve(loadContext.rebaseTo, relativeUri);
11392
+ if (!fs9.existsSync(absoluteUri) || !fs9.statSync(absoluteUri).isFile()) {
11393
11393
  loadContext.warnings.push('Ignoring local source map at "' + absoluteUri + '" as resource is missing.');
11394
11394
  return null;
11395
11395
  }
@@ -11397,7 +11397,7 @@ var require_load_original_sources = __commonJS({
11397
11397
  loadContext.warnings.push('Cannot fetch "' + absoluteUri + '" as resource is not allowed.');
11398
11398
  return null;
11399
11399
  }
11400
- var result = fs6.readFileSync(absoluteUri, "utf8");
11400
+ var result = fs9.readFileSync(absoluteUri, "utf8");
11401
11401
  if (result.charCodeAt(0) === 65279) {
11402
11402
  result = result.substring(1);
11403
11403
  }
@@ -11412,8 +11412,8 @@ var require_normalize_path = __commonJS({
11412
11412
  "node_modules/clean-css/lib/reader/normalize-path.js"(exports2, module2) {
11413
11413
  var UNIX_SEPARATOR = "/";
11414
11414
  var WINDOWS_SEPARATOR_PATTERN = /\\/g;
11415
- function normalizePath(path4) {
11416
- return path4.replace(WINDOWS_SEPARATOR_PATTERN, UNIX_SEPARATOR);
11415
+ function normalizePath(path7) {
11416
+ return path7.replace(WINDOWS_SEPARATOR_PATTERN, UNIX_SEPARATOR);
11417
11417
  }
11418
11418
  module2.exports = normalizePath;
11419
11419
  }
@@ -11432,7 +11432,7 @@ var require_restore_import = __commonJS({
11432
11432
  // node_modules/clean-css/lib/reader/rewrite-url.js
11433
11433
  var require_rewrite_url = __commonJS({
11434
11434
  "node_modules/clean-css/lib/reader/rewrite-url.js"(exports2, module2) {
11435
- var path4 = require("path");
11435
+ var path7 = require("path");
11436
11436
  var url = require("url");
11437
11437
  var isDataUriResource = require_is_data_uri_resource();
11438
11438
  var DOUBLE_QUOTE = '"';
@@ -11463,7 +11463,7 @@ var require_rewrite_url = __commonJS({
11463
11463
  return rebaseConfig.absolute ? normalize(absolute(uri, rebaseConfig)) : normalize(relative(uri, rebaseConfig));
11464
11464
  }
11465
11465
  function isAbsolute(uri) {
11466
- return path4.isAbsolute(uri);
11466
+ return path7.isAbsolute(uri);
11467
11467
  }
11468
11468
  function isSVGMarker(uri) {
11469
11469
  return uri[0] == "#";
@@ -11475,10 +11475,10 @@ var require_rewrite_url = __commonJS({
11475
11475
  return /^[^:]+?:\/\//.test(uri) || PROTOCOL_LESS_PREFIX_PATTERN.test(uri);
11476
11476
  }
11477
11477
  function absolute(uri, rebaseConfig) {
11478
- return path4.resolve(path4.join(rebaseConfig.fromBase || "", uri)).replace(rebaseConfig.toBase, "");
11478
+ return path7.resolve(path7.join(rebaseConfig.fromBase || "", uri)).replace(rebaseConfig.toBase, "");
11479
11479
  }
11480
11480
  function relative(uri, rebaseConfig) {
11481
- return path4.relative(rebaseConfig.toBase, path4.join(rebaseConfig.fromBase || "", uri));
11481
+ return path7.relative(rebaseConfig.toBase, path7.join(rebaseConfig.fromBase || "", uri));
11482
11482
  }
11483
11483
  function normalize(uri) {
11484
11484
  return isWindows ? uri.replace(/\\/g, "/") : uri;
@@ -12273,8 +12273,8 @@ var require_tokenize = __commonJS({
12273
12273
  // node_modules/clean-css/lib/reader/read-sources.js
12274
12274
  var require_read_sources = __commonJS({
12275
12275
  "node_modules/clean-css/lib/reader/read-sources.js"(exports2, module2) {
12276
- var fs6 = require("fs");
12277
- var path4 = require("path");
12276
+ var fs9 = require("fs");
12277
+ var path7 = require("path");
12278
12278
  var applySourceMaps = require_apply_source_maps();
12279
12279
  var extractImportUrlAndMedia = require_extract_import_url_and_media();
12280
12280
  var isAllowedResource = require_is_allowed_resource();
@@ -12354,15 +12354,15 @@ var require_read_sources = __commonJS({
12354
12354
  return imports;
12355
12355
  }
12356
12356
  function normalizeUri(uri) {
12357
- var currentPath = path4.resolve("");
12357
+ var currentPath = path7.resolve("");
12358
12358
  var absoluteUri;
12359
12359
  var relativeToCurrentPath;
12360
12360
  var normalizedUri;
12361
12361
  if (isRemoteResource(uri)) {
12362
12362
  return uri;
12363
12363
  }
12364
- absoluteUri = path4.isAbsolute(uri) ? uri : path4.resolve(uri);
12365
- relativeToCurrentPath = path4.relative(currentPath, absoluteUri);
12364
+ absoluteUri = path7.isAbsolute(uri) ? uri : path7.resolve(uri);
12365
+ relativeToCurrentPath = path7.relative(currentPath, absoluteUri);
12366
12366
  normalizedUri = normalizePath(relativeToCurrentPath);
12367
12367
  return normalizedUri;
12368
12368
  }
@@ -12378,16 +12378,16 @@ var require_read_sources = __commonJS({
12378
12378
  var tokens;
12379
12379
  var rebaseConfig = {};
12380
12380
  if (!context2.source) {
12381
- rebaseConfig.fromBase = path4.resolve("");
12381
+ rebaseConfig.fromBase = path7.resolve("");
12382
12382
  rebaseConfig.toBase = context2.options.rebaseTo;
12383
12383
  } else if (isRemoteResource(context2.source)) {
12384
12384
  rebaseConfig.fromBase = context2.source;
12385
12385
  rebaseConfig.toBase = context2.source;
12386
- } else if (path4.isAbsolute(context2.source)) {
12387
- rebaseConfig.fromBase = path4.dirname(context2.source);
12386
+ } else if (path7.isAbsolute(context2.source)) {
12387
+ rebaseConfig.fromBase = path7.dirname(context2.source);
12388
12388
  rebaseConfig.toBase = context2.options.rebaseTo;
12389
12389
  } else {
12390
- rebaseConfig.fromBase = path4.dirname(path4.resolve(context2.source));
12390
+ rebaseConfig.fromBase = path7.dirname(path7.resolve(context2.source));
12391
12391
  rebaseConfig.toBase = context2.options.rebaseTo;
12392
12392
  }
12393
12393
  tokens = tokenize(styles, context2);
@@ -12507,16 +12507,16 @@ var require_read_sources = __commonJS({
12507
12507
  }
12508
12508
  function inlineLocalStylesheet(uri, mediaQuery, metadata, inlinerContext) {
12509
12509
  var protocolLessUri = uri.replace(FILE_RESOURCE_PROTOCOL, "");
12510
- var currentPath = path4.resolve("");
12511
- var absoluteUri = path4.isAbsolute(protocolLessUri) ? path4.resolve(currentPath, protocolLessUri[0] == "/" ? protocolLessUri.substring(1) : protocolLessUri) : path4.resolve(inlinerContext.rebaseTo, protocolLessUri);
12512
- var relativeToCurrentPath = path4.relative(currentPath, absoluteUri);
12510
+ var currentPath = path7.resolve("");
12511
+ var absoluteUri = path7.isAbsolute(protocolLessUri) ? path7.resolve(currentPath, protocolLessUri[0] == "/" ? protocolLessUri.substring(1) : protocolLessUri) : path7.resolve(inlinerContext.rebaseTo, protocolLessUri);
12512
+ var relativeToCurrentPath = path7.relative(currentPath, absoluteUri);
12513
12513
  var importedStyles;
12514
12514
  var isAllowed = isAllowedResource(protocolLessUri, false, inlinerContext.inline);
12515
12515
  var normalizedPath = normalizePath(relativeToCurrentPath);
12516
12516
  var isLoaded = normalizedPath in inlinerContext.externalContext.sourcesContent;
12517
12517
  if (inlinerContext.inlinedStylesheets.indexOf(absoluteUri) > -1) {
12518
12518
  inlinerContext.warnings.push('Ignoring local @import of "' + protocolLessUri + '" as it has already been imported.');
12519
- } else if (isAllowed && !isLoaded && (!fs6.existsSync(absoluteUri) || !fs6.statSync(absoluteUri).isFile())) {
12519
+ } else if (isAllowed && !isLoaded && (!fs9.existsSync(absoluteUri) || !fs9.statSync(absoluteUri).isFile())) {
12520
12520
  inlinerContext.errors.push('Ignoring local @import of "' + protocolLessUri + '" as resource is missing.');
12521
12521
  } else if (!isAllowed && inlinerContext.afterContent) {
12522
12522
  inlinerContext.warnings.push('Ignoring local @import of "' + protocolLessUri + '" as resource is not allowed and after other content.');
@@ -12526,7 +12526,7 @@ var require_read_sources = __commonJS({
12526
12526
  inlinerContext.warnings.push('Skipping local @import of "' + protocolLessUri + '" as resource is not allowed.');
12527
12527
  inlinerContext.outputTokens = inlinerContext.outputTokens.concat(inlinerContext.sourceTokens.slice(0, 1));
12528
12528
  } else {
12529
- importedStyles = isLoaded ? inlinerContext.externalContext.sourcesContent[normalizedPath] : fs6.readFileSync(absoluteUri, "utf-8");
12529
+ importedStyles = isLoaded ? inlinerContext.externalContext.sourcesContent[normalizedPath] : fs9.readFileSync(absoluteUri, "utf-8");
12530
12530
  if (importedStyles.charCodeAt(0) === 65279) {
12531
12531
  importedStyles = importedStyles.substring(1);
12532
12532
  }
@@ -13838,36 +13838,36 @@ var require_path = __commonJS({
13838
13838
  return verdict;
13839
13839
  }
13840
13840
  function parsePath(urlObj, options) {
13841
- var path4 = urlObj.path.absolute.string;
13842
- if (path4) {
13843
- var lastSlash = path4.lastIndexOf("/");
13841
+ var path7 = urlObj.path.absolute.string;
13842
+ if (path7) {
13843
+ var lastSlash = path7.lastIndexOf("/");
13844
13844
  if (lastSlash > -1) {
13845
- if (++lastSlash < path4.length) {
13846
- var resource = path4.substr(lastSlash);
13845
+ if (++lastSlash < path7.length) {
13846
+ var resource = path7.substr(lastSlash);
13847
13847
  if (resource !== "." && resource !== "..") {
13848
13848
  urlObj.resource = resource;
13849
- path4 = path4.substr(0, lastSlash);
13849
+ path7 = path7.substr(0, lastSlash);
13850
13850
  } else {
13851
- path4 += "/";
13851
+ path7 += "/";
13852
13852
  }
13853
13853
  }
13854
- urlObj.path.absolute.string = path4;
13855
- urlObj.path.absolute.array = splitPath(path4);
13856
- } else if (path4 === "." || path4 === "..") {
13857
- path4 += "/";
13858
- urlObj.path.absolute.string = path4;
13859
- urlObj.path.absolute.array = splitPath(path4);
13854
+ urlObj.path.absolute.string = path7;
13855
+ urlObj.path.absolute.array = splitPath(path7);
13856
+ } else if (path7 === "." || path7 === "..") {
13857
+ path7 += "/";
13858
+ urlObj.path.absolute.string = path7;
13859
+ urlObj.path.absolute.array = splitPath(path7);
13860
13860
  } else {
13861
- urlObj.resource = path4;
13861
+ urlObj.resource = path7;
13862
13862
  urlObj.path.absolute.string = null;
13863
13863
  }
13864
13864
  urlObj.extra.resourceIsIndex = isDirectoryIndex(urlObj.resource, options);
13865
13865
  }
13866
13866
  }
13867
- function splitPath(path4) {
13868
- if (path4 !== "/") {
13867
+ function splitPath(path7) {
13868
+ if (path7 !== "/") {
13869
13869
  var cleaned = [];
13870
- path4.split("/").forEach(function(dir) {
13870
+ path7.split("/").forEach(function(dir) {
13871
13871
  if (dir !== "") {
13872
13872
  cleaned.push(dir);
13873
13873
  }
@@ -14813,16 +14813,16 @@ var require_resolve_uri_umd = __commonJS({
14813
14813
  }
14814
14814
  function parseFileUrl(input) {
14815
14815
  const match = fileRegex.exec(input);
14816
- const path4 = match[2];
14817
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
14816
+ const path7 = match[2];
14817
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path7) ? path7 : "/" + path7, match[3] || "", match[4] || "");
14818
14818
  }
14819
- function makeUrl(scheme, user, host, port, path4, query, hash) {
14819
+ function makeUrl(scheme, user, host, port, path7, query, hash) {
14820
14820
  return {
14821
14821
  scheme,
14822
14822
  user,
14823
14823
  host,
14824
14824
  port,
14825
- path: path4,
14825
+ path: path7,
14826
14826
  query,
14827
14827
  hash,
14828
14828
  type: 7
@@ -14852,11 +14852,11 @@ var require_resolve_uri_umd = __commonJS({
14852
14852
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
14853
14853
  return url;
14854
14854
  }
14855
- function stripPathFilename(path4) {
14856
- if (path4.endsWith("/.."))
14857
- return path4;
14858
- const index = path4.lastIndexOf("/");
14859
- return path4.slice(0, index + 1);
14855
+ function stripPathFilename(path7) {
14856
+ if (path7.endsWith("/.."))
14857
+ return path7;
14858
+ const index = path7.lastIndexOf("/");
14859
+ return path7.slice(0, index + 1);
14860
14860
  }
14861
14861
  function mergePaths(url, base) {
14862
14862
  normalizePath(base, base.type);
@@ -14894,14 +14894,14 @@ var require_resolve_uri_umd = __commonJS({
14894
14894
  pieces[pointer++] = piece;
14895
14895
  positive++;
14896
14896
  }
14897
- let path4 = "";
14897
+ let path7 = "";
14898
14898
  for (let i = 1; i < pointer; i++) {
14899
- path4 += "/" + pieces[i];
14899
+ path7 += "/" + pieces[i];
14900
14900
  }
14901
- if (!path4 || addTrailingSlash && !path4.endsWith("/..")) {
14902
- path4 += "/";
14901
+ if (!path7 || addTrailingSlash && !path7.endsWith("/..")) {
14902
+ path7 += "/";
14903
14903
  }
14904
- url.path = path4;
14904
+ url.path = path7;
14905
14905
  }
14906
14906
  function resolve2(input, base) {
14907
14907
  if (!input && !base)
@@ -14942,13 +14942,13 @@ var require_resolve_uri_umd = __commonJS({
14942
14942
  case 3:
14943
14943
  return queryHash;
14944
14944
  case 4: {
14945
- const path4 = url.path.slice(1);
14946
- if (!path4)
14945
+ const path7 = url.path.slice(1);
14946
+ if (!path7)
14947
14947
  return queryHash || ".";
14948
- if (isRelative(base || input) && !isRelative(path4)) {
14949
- return "./" + path4 + queryHash;
14948
+ if (isRelative(base || input) && !isRelative(path7)) {
14949
+ return "./" + path7 + queryHash;
14950
14950
  }
14951
- return path4 + queryHash;
14951
+ return path7 + queryHash;
14952
14952
  }
14953
14953
  case 5:
14954
14954
  return url.path + queryHash;
@@ -15047,10 +15047,10 @@ var require_trace_mapping_umd = __commonJS({
15047
15047
  module3.exports = __toCommonJS(trace_mapping_exports);
15048
15048
  var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
15049
15049
  var import_resolve_uri = __toESM2(require_resolve_uri());
15050
- function stripFilename(path4) {
15051
- if (!path4) return "";
15052
- const index = path4.lastIndexOf("/");
15053
- return path4.slice(0, index + 1);
15050
+ function stripFilename(path7) {
15051
+ if (!path7) return "";
15052
+ const index = path7.lastIndexOf("/");
15053
+ return path7.slice(0, index + 1);
15054
15054
  }
15055
15055
  function resolver(mapUrl, sourceRoot) {
15056
15056
  const from = stripFilename(mapUrl);
@@ -39505,13 +39505,13 @@ var require_bundle_min = __commonJS({
39505
39505
  }
39506
39506
  return self2;
39507
39507
  });
39508
- function is_nullish_check(check, check_subject, compressor) {
39508
+ function is_nullish_check(check2, check_subject, compressor) {
39509
39509
  if (check_subject.may_throw(compressor)) return false;
39510
39510
  let nullish_side;
39511
- if (check instanceof AST_Binary && check.operator === "==" && ((nullish_side = is_nullish(check.left, compressor) && check.left) || (nullish_side = is_nullish(check.right, compressor) && check.right)) && (nullish_side === check.left ? check.right : check.left).equivalent_to(check_subject)) {
39511
+ if (check2 instanceof AST_Binary && check2.operator === "==" && ((nullish_side = is_nullish(check2.left, compressor) && check2.left) || (nullish_side = is_nullish(check2.right, compressor) && check2.right)) && (nullish_side === check2.left ? check2.right : check2.left).equivalent_to(check_subject)) {
39512
39512
  return true;
39513
39513
  }
39514
- if (check instanceof AST_Binary && check.operator === "||") {
39514
+ if (check2 instanceof AST_Binary && check2.operator === "||") {
39515
39515
  let null_cmp;
39516
39516
  let undefined_cmp;
39517
39517
  const find_comparison = (cmp) => {
@@ -39548,8 +39548,8 @@ var require_bundle_min = __commonJS({
39548
39548
  }
39549
39549
  return true;
39550
39550
  };
39551
- if (!find_comparison(check.left)) return false;
39552
- if (!find_comparison(check.right)) return false;
39551
+ if (!find_comparison(check2.left)) return false;
39552
+ if (!find_comparison(check2.right)) return false;
39553
39553
  if (null_cmp && undefined_cmp && null_cmp !== undefined_cmp) {
39554
39554
  return true;
39555
39555
  }
@@ -49862,12 +49862,12 @@ var require_bundle_min = __commonJS({
49862
49862
  props: map_to_object(cache.props)
49863
49863
  };
49864
49864
  }
49865
- function log_input(files, options, fs6, debug_folder) {
49866
- if (!(fs6 && fs6.writeFileSync && fs6.mkdirSync)) {
49865
+ function log_input(files, options, fs9, debug_folder) {
49866
+ if (!(fs9 && fs9.writeFileSync && fs9.mkdirSync)) {
49867
49867
  return;
49868
49868
  }
49869
49869
  try {
49870
- fs6.mkdirSync(debug_folder);
49870
+ fs9.mkdirSync(debug_folder);
49871
49871
  } catch (e) {
49872
49872
  if (e.code !== "EEXIST") throw e;
49873
49873
  }
@@ -49889,7 +49889,7 @@ var require_bundle_min = __commonJS({
49889
49889
  return file;
49890
49890
  }
49891
49891
  };
49892
- fs6.writeFileSync(log_path, "Options: \n" + options_str + "\n\nInput files:\n\n" + files_str(files) + "\n");
49892
+ fs9.writeFileSync(log_path, "Options: \n" + options_str + "\n\nInput files:\n\n" + files_str(files) + "\n");
49893
49893
  }
49894
49894
  function* minify_sync_or_async(files, options, _fs_module) {
49895
49895
  if (_fs_module && typeof process === "object" && process.env && typeof process.env.TERSER_DEBUG_DIR === "string") {
@@ -50158,7 +50158,7 @@ var require_bundle_min = __commonJS({
50158
50158
  } while (!val.done);
50159
50159
  return val.value;
50160
50160
  }
50161
- async function run_cli({ program, packageJson, fs: fs6, path: path4 }) {
50161
+ async function run_cli({ program, packageJson, fs: fs9, path: path7 }) {
50162
50162
  const skip_keys = /* @__PURE__ */ new Set(["cname", "parent_scope", "scope", "uses_eval", "uses_with"]);
50163
50163
  var files = {};
50164
50164
  var options = {
@@ -50291,7 +50291,7 @@ var require_bundle_min = __commonJS({
50291
50291
  var base = program.sourceMap.base;
50292
50292
  delete options.sourceMap.base;
50293
50293
  return function(name) {
50294
- return path4.relative(base, name);
50294
+ return path7.relative(base, name);
50295
50295
  };
50296
50296
  })();
50297
50297
  }
@@ -50355,7 +50355,7 @@ var require_bundle_min = __commonJS({
50355
50355
  }
50356
50356
  let result;
50357
50357
  try {
50358
- result = await minify2(files, options, fs6);
50358
+ result = await minify2(files, options, fs9);
50359
50359
  } catch (ex) {
50360
50360
  if (ex.name == "SyntaxError") {
50361
50361
  print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col);
@@ -50429,7 +50429,7 @@ var require_bundle_min = __commonJS({
50429
50429
  code: false
50430
50430
  }
50431
50431
  },
50432
- fs6
50432
+ fs9
50433
50433
  );
50434
50434
  console.log(JSON.stringify(minified.ast.to_mozilla_ast(), null, 2));
50435
50435
  } catch (ex) {
@@ -50437,16 +50437,16 @@ var require_bundle_min = __commonJS({
50437
50437
  return;
50438
50438
  }
50439
50439
  } else if (program.output) {
50440
- fs6.mkdirSync(path4.dirname(program.output), { recursive: true });
50441
- fs6.writeFileSync(program.output, result.code);
50440
+ fs9.mkdirSync(path7.dirname(program.output), { recursive: true });
50441
+ fs9.writeFileSync(program.output, result.code);
50442
50442
  if (options.sourceMap && options.sourceMap.url !== "inline" && result.map) {
50443
- fs6.writeFileSync(program.output + ".map", result.map);
50443
+ fs9.writeFileSync(program.output + ".map", result.map);
50444
50444
  }
50445
50445
  } else {
50446
50446
  console.log(result.code);
50447
50447
  }
50448
50448
  if (program.nameCache) {
50449
- fs6.writeFileSync(program.nameCache, JSON.stringify(options.nameCache));
50449
+ fs9.writeFileSync(program.nameCache, JSON.stringify(options.nameCache));
50450
50450
  }
50451
50451
  if (result.timings) for (var phase in result.timings) {
50452
50452
  print_error("- " + phase + ": " + result.timings[phase].toFixed(3) + "s");
@@ -50462,28 +50462,28 @@ var require_bundle_min = __commonJS({
50462
50462
  return [].concat.apply([], glob.map(simple_glob));
50463
50463
  }
50464
50464
  if (glob && glob.match(/[*?]/)) {
50465
- var dir = path4.dirname(glob);
50465
+ var dir = path7.dirname(glob);
50466
50466
  try {
50467
- var entries = fs6.readdirSync(dir);
50467
+ var entries = fs9.readdirSync(dir);
50468
50468
  } catch (ex) {
50469
50469
  }
50470
50470
  if (entries) {
50471
- var pattern = "^" + path4.basename(glob).replace(/[.+^$[\]\\(){}]/g, "\\$&").replace(/\*/g, "[^/\\\\]*").replace(/\?/g, "[^/\\\\]") + "$";
50471
+ var pattern = "^" + path7.basename(glob).replace(/[.+^$[\]\\(){}]/g, "\\$&").replace(/\*/g, "[^/\\\\]*").replace(/\?/g, "[^/\\\\]") + "$";
50472
50472
  var mod = process.platform === "win32" ? "i" : "";
50473
50473
  var rx = new RegExp(pattern, mod);
50474
50474
  var results = entries.filter(function(name) {
50475
50475
  return rx.test(name);
50476
50476
  }).map(function(name) {
50477
- return path4.join(dir, name);
50477
+ return path7.join(dir, name);
50478
50478
  });
50479
50479
  if (results.length) return results;
50480
50480
  }
50481
50481
  }
50482
50482
  return [glob];
50483
50483
  }
50484
- function read_file(path5, default_value) {
50484
+ function read_file(path8, default_value) {
50485
50485
  try {
50486
- return fs6.readFileSync(path5, "utf8");
50486
+ return fs9.readFileSync(path8, "utf8");
50487
50487
  } catch (ex) {
50488
50488
  if ((ex.code == "ENOENT" || ex.code == "ENAMETOOLONG") && default_value != null) return default_value;
50489
50489
  fatal(ex);
@@ -56665,17 +56665,17 @@ var require_lib10 = __commonJS({
56665
56665
  var require_lib11 = __commonJS({
56666
56666
  "node_modules/posthtml-include/lib/index.js"(exports2, module2) {
56667
56667
  "use strict";
56668
- var fs6 = require("fs");
56669
- var path4 = require("path");
56668
+ var fs9 = require("fs");
56669
+ var path7 = require("path");
56670
56670
  var posthtml2 = require_lib9();
56671
56671
  var { parser } = require_dist();
56672
56672
  var { match } = require_api();
56673
56673
  var expressions = require_lib10();
56674
56674
  module2.exports = (options = {}) => {
56675
- options.root = options.root ? path4.resolve(options.root) : process.cwd();
56675
+ options.root = options.root ? path7.resolve(options.root) : process.cwd();
56676
56676
  options.encoding = options.encoding || "utf-8";
56677
56677
  return function posthtmlInclude(tree) {
56678
- const cwd = options.cwd ? path4.resolve(options.cwd) : tree.options.from ? path4.dirname(path4.resolve(tree.options.from)) : process.cwd();
56678
+ const cwd = options.cwd ? path7.resolve(options.cwd) : tree.options.from ? path7.dirname(path7.resolve(tree.options.from)) : process.cwd();
56679
56679
  tree.parser = tree.parser || parser;
56680
56680
  tree.match = tree.match || match;
56681
56681
  tree.match({ tag: "include" }, (node) => {
@@ -56690,8 +56690,8 @@ var require_lib11 = __commonJS({
56690
56690
  posthtmlExpressionsOptions.delimiters = options.delimiters;
56691
56691
  }
56692
56692
  if (src) {
56693
- src = path4.isAbsolute(src) ? path4.resolve(cwd, src) : path4.join(options.root, src);
56694
- source = fs6.readFileSync(src, options.encoding);
56693
+ src = path7.isAbsolute(src) ? path7.resolve(cwd, src) : path7.join(options.root, src);
56694
+ source = fs9.readFileSync(src, options.encoding);
56695
56695
  try {
56696
56696
  const localsRaw = node.attrs.locals || (node.content ? node.content.join().replace(/\n/g, "") : false);
56697
56697
  const localsJson = JSON.parse(localsRaw);
@@ -56707,7 +56707,7 @@ var require_lib11 = __commonJS({
56707
56707
  }
56708
56708
  subtree = tree.parser(source);
56709
56709
  subtree.options = subtree.options || {};
56710
- subtree.options.from = path4.isAbsolute(src) ? src : tree.options.from ? path4.relative(tree.options.from, src) : src;
56710
+ subtree.options.from = path7.isAbsolute(src) ? src : tree.options.from ? path7.relative(tree.options.from, src) : src;
56711
56711
  subtree.match = tree.match;
56712
56712
  subtree.parser = tree.parser;
56713
56713
  subtree.messages = tree.messages;
@@ -56913,38 +56913,204 @@ ${fileContent}`;
56913
56913
  console.log("\u{1F389} Deployment complete!");
56914
56914
  }
56915
56915
 
56916
+ // src/commands/deploy-functions.ts
56917
+ var fs3 = __toESM(require("fs"));
56918
+ var path3 = __toESM(require("path"));
56919
+ var import_child_process2 = require("child_process");
56920
+
56921
+ // src/utils/toolchain.ts
56922
+ var fs2 = __toESM(require("fs"));
56923
+ var path2 = __toESM(require("path"));
56924
+ function packageRoot() {
56925
+ for (const candidate of [
56926
+ path2.join(__dirname, ".."),
56927
+ // dist/index.js → raíz del paquete
56928
+ path2.join(__dirname, "..", "..")
56929
+ // src/utils/*.ts corrido directo
56930
+ ]) {
56931
+ if (fs2.existsSync(path2.join(candidate, "configs", "tailwind.config.cjs"))) {
56932
+ return candidate;
56933
+ }
56934
+ }
56935
+ throw new Error("No pude resolver la ra\xEDz del paquete del builder (falta configs/)");
56936
+ }
56937
+ function tailwindCommand(extraArgs) {
56938
+ const hasOwnConfig = ["js", "cjs", "mjs", "ts"].some(
56939
+ (ext) => fs2.existsSync(path2.join(process.cwd(), `tailwind.config.${ext}`))
56940
+ );
56941
+ const configArgs = hasOwnConfig ? [] : ["-c", path2.join(packageRoot(), "configs", "tailwind.config.cjs")];
56942
+ try {
56943
+ const twRoot = path2.dirname(require.resolve("tailwindcss/package.json"));
56944
+ const cli = path2.join(twRoot, "lib", "cli.js");
56945
+ if (fs2.existsSync(cli)) {
56946
+ return { cmd: process.execPath, args: [cli, ...extraArgs, ...configArgs] };
56947
+ }
56948
+ } catch {
56949
+ }
56950
+ return { cmd: "bunx", args: ["tailwindcss", ...extraArgs, ...configArgs] };
56951
+ }
56952
+ function loadEnvFile(env) {
56953
+ const file = path2.join(process.cwd(), `.env.${env}`);
56954
+ if (!fs2.existsSync(file)) return false;
56955
+ for (const line of fs2.readFileSync(file, "utf-8").split("\n")) {
56956
+ const trimmed = line.trim();
56957
+ if (!trimmed || trimmed.startsWith("#")) continue;
56958
+ const eq = trimmed.indexOf("=");
56959
+ if (eq === -1) continue;
56960
+ const key = trimmed.slice(0, eq).trim();
56961
+ let value = trimmed.slice(eq + 1).trim();
56962
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
56963
+ value = value.slice(1, -1);
56964
+ }
56965
+ if (process.env[key] === void 0) {
56966
+ process.env[key] = value;
56967
+ }
56968
+ }
56969
+ return true;
56970
+ }
56971
+
56972
+ // src/commands/deploy-functions.ts
56973
+ function deployFunctions() {
56974
+ const CWD2 = process.cwd();
56975
+ const projectRef = process.env.MINIAPP_SUPABASE_PROJECT_ID;
56976
+ const accessToken = process.env.MINIAPP_SUPABASE_ACCESS_TOKEN;
56977
+ if (!projectRef || !accessToken) {
56978
+ console.error(
56979
+ "\u274C Missing MINIAPP_SUPABASE_PROJECT_ID or MINIAPP_SUPABASE_ACCESS_TOKEN"
56980
+ );
56981
+ process.exit(1);
56982
+ }
56983
+ const supabaseEnv = { ...process.env, SUPABASE_ACCESS_TOKEN: accessToken };
56984
+ const workdir = path3.join(CWD2, ".temp", "functions-deploy");
56985
+ const functionsDir = path3.join(workdir, "supabase", "functions");
56986
+ fs3.rmSync(workdir, { recursive: true, force: true });
56987
+ fs3.mkdirSync(functionsDir, { recursive: true });
56988
+ fs3.cpSync(path3.join(packageRoot(), "templates", "functions"), functionsDir, {
56989
+ recursive: true
56990
+ });
56991
+ fs3.writeFileSync(
56992
+ path3.join(workdir, "supabase", "config.toml"),
56993
+ `project_id = "miniapp"
56994
+
56995
+ [functions.deploy_miniapp]
56996
+ verify_jwt = false
56997
+ `
56998
+ );
56999
+ console.log("\u{1F6F0} Deploying deploy_miniapp (builder template)...");
57000
+ const deployInfra = (0, import_child_process2.spawnSync)(
57001
+ "supabase",
57002
+ ["functions", "deploy", "deploy_miniapp", "--project-ref", projectRef],
57003
+ { stdio: "inherit", cwd: workdir, env: supabaseEnv }
57004
+ );
57005
+ if (deployInfra.status !== 0) {
57006
+ console.error("\u274C deploy_miniapp function deploy failed");
57007
+ process.exit(1);
57008
+ }
57009
+ const secretKeys = [
57010
+ "MINIAPP_API_KEY",
57011
+ "MINIAPP_DEPLOY_SECRET",
57012
+ "CORE_DEV_SUPABASE_URL",
57013
+ "CORE_DEV_SUPABASE_ANON_PUBLIC",
57014
+ "CORE_PROD_SUPABASE_URL",
57015
+ "CORE_PROD_SUPABASE_ANON_PUBLIC",
57016
+ "MINIAPP_SLUG",
57017
+ "MINIAPP_NAME"
57018
+ ];
57019
+ const secretArgs = secretKeys.filter((k) => process.env[k]).map((k) => `${k}=${process.env[k]}`);
57020
+ if (secretArgs.length > 0) {
57021
+ console.log("\u{1F510} Setting function secrets...");
57022
+ const setSecrets = (0, import_child_process2.spawnSync)(
57023
+ "supabase",
57024
+ ["secrets", "set", "--project-ref", projectRef, ...secretArgs],
57025
+ { stdio: "inherit", cwd: workdir, env: supabaseEnv }
57026
+ );
57027
+ if (setSecrets.status !== 0) {
57028
+ console.error("\u274C secrets set failed");
57029
+ process.exit(1);
57030
+ }
57031
+ }
57032
+ const customFunctionsDir = path3.join(CWD2, "supabase", "functions");
57033
+ if (fs3.existsSync(customFunctionsDir)) {
57034
+ console.log("\u{1F6F0} Deploying custom functions from supabase/functions/...");
57035
+ const deployCustom = (0, import_child_process2.spawnSync)(
57036
+ "supabase",
57037
+ ["functions", "deploy", "--project-ref", projectRef],
57038
+ { stdio: "inherit", cwd: CWD2, env: supabaseEnv }
57039
+ );
57040
+ if (deployCustom.status !== 0) {
57041
+ console.error("\u274C custom functions deploy failed");
57042
+ process.exit(1);
57043
+ }
57044
+ } else {
57045
+ console.log("\u2139\uFE0F No supabase/functions/ dir \u2014 no custom functions to deploy");
57046
+ }
57047
+ console.log("\u2705 Functions deploy complete");
57048
+ }
57049
+
57050
+ // src/commands/check.ts
57051
+ var fs4 = __toESM(require("fs"));
57052
+ var path4 = __toESM(require("path"));
57053
+ var import_child_process3 = require("child_process");
57054
+ function check() {
57055
+ const CWD2 = process.cwd();
57056
+ let failed = false;
57057
+ const run = (label, cmd, args2) => {
57058
+ console.log(`
57059
+ \u{1F4DD} ${label}...`);
57060
+ const res = (0, import_child_process3.spawnSync)(cmd, args2, { stdio: "inherit", cwd: CWD2 });
57061
+ if (res.status !== 0) failed = true;
57062
+ };
57063
+ run("ESLint", "bunx", ["eslint", "src"]);
57064
+ run("TypeScript", "bunx", ["tsc", "--noEmit"]);
57065
+ const customFunctionsDir = path4.join(CWD2, "supabase", "functions");
57066
+ if (fs4.existsSync(customFunctionsDir)) {
57067
+ const denoAvailable = (0, import_child_process3.spawnSync)("deno", ["--version"], { stdio: "ignore" }).status === 0;
57068
+ if (denoAvailable) {
57069
+ run("Deno check (custom functions)", "deno", ["check", "supabase/functions/**/*.ts"]);
57070
+ run("Deno lint (custom functions)", "deno", ["lint", "supabase/functions/"]);
57071
+ } else {
57072
+ console.warn("\u26A0\uFE0F supabase/functions/ existe pero deno no est\xE1 instalado \u2014 skip deno check");
57073
+ }
57074
+ }
57075
+ if (failed) {
57076
+ console.error("\n\u274C Checks failed");
57077
+ process.exit(1);
57078
+ }
57079
+ console.log("\n\u2705 All checks passed");
57080
+ }
57081
+
56916
57082
  // src/commands/build.ts
56917
57083
  var esbuild = __toESM(require("esbuild"));
56918
- var import_child_process2 = require("child_process");
57084
+ var import_child_process4 = require("child_process");
56919
57085
 
56920
57086
  // src/utils/paths.ts
56921
- var path2 = __toESM(require("path"));
57087
+ var path5 = __toESM(require("path"));
56922
57088
  var CWD = process.cwd();
56923
- var SRC_DIR = path2.join(CWD, "src");
56924
- var HTML_SRC_DIR = path2.join(SRC_DIR, "html");
56925
- var TEMP_DIR = path2.join(CWD, ".temp");
56926
- var BUILD_DIR = path2.join(CWD, "build");
57089
+ var SRC_DIR = path5.join(CWD, "src");
57090
+ var HTML_SRC_DIR = path5.join(SRC_DIR, "html");
57091
+ var TEMP_DIR = path5.join(CWD, ".temp");
57092
+ var BUILD_DIR = path5.join(CWD, "build");
56927
57093
  var FILES = {
56928
- inputHtml: path2.join(HTML_SRC_DIR, "index.html"),
56929
- tempHtml: path2.join(TEMP_DIR, "index.html"),
56930
- tempSdk: path2.join(TEMP_DIR, "sdk.js"),
56931
- css: path2.join(TEMP_DIR, "output.css"),
56932
- inputCss: path2.join(SRC_DIR, "input.css"),
56933
- js: path2.join(TEMP_DIR, "alpine.js"),
56934
- inputJs: path2.join(SRC_DIR, "alpine.ts"),
56935
- outputHtml: path2.join(BUILD_DIR, "index.html")
57094
+ inputHtml: path5.join(HTML_SRC_DIR, "index.html"),
57095
+ tempHtml: path5.join(TEMP_DIR, "index.html"),
57096
+ tempSdk: path5.join(TEMP_DIR, "sdk.js"),
57097
+ css: path5.join(TEMP_DIR, "output.css"),
57098
+ inputCss: path5.join(SRC_DIR, "input.css"),
57099
+ js: path5.join(TEMP_DIR, "alpine.js"),
57100
+ inputJs: path5.join(SRC_DIR, "alpine.ts"),
57101
+ outputHtml: path5.join(BUILD_DIR, "index.html")
56936
57102
  };
56937
57103
 
56938
57104
  // src/commands/process-html.ts
56939
- var fs3 = __toESM(require("fs"));
57105
+ var fs6 = __toESM(require("fs"));
56940
57106
 
56941
57107
  // src/utils/sdk-finder.ts
56942
- var fs2 = __toESM(require("fs"));
56943
- var path3 = __toESM(require("path"));
57108
+ var fs5 = __toESM(require("fs"));
57109
+ var path6 = __toESM(require("path"));
56944
57110
  function findSdkPath() {
56945
57111
  if (process.env.LOCALE_SDK_PATH) {
56946
- const envPath = path3.resolve(CWD, process.env.LOCALE_SDK_PATH);
56947
- if (fs2.existsSync(envPath)) return envPath;
57112
+ const envPath = path6.resolve(CWD, process.env.LOCALE_SDK_PATH);
57113
+ if (fs5.existsSync(envPath)) return envPath;
56948
57114
  }
56949
57115
  try {
56950
57116
  const nodeModulePath = require.resolve(
@@ -56953,11 +57119,11 @@ function findSdkPath() {
56953
57119
  paths: [CWD, __dirname]
56954
57120
  }
56955
57121
  );
56956
- if (fs2.existsSync(nodeModulePath)) return nodeModulePath;
57122
+ if (fs5.existsSync(nodeModulePath)) return nodeModulePath;
56957
57123
  } catch (e) {
56958
57124
  }
56959
- const localPath = path3.join(SRC_DIR, "sdk.js");
56960
- if (fs2.existsSync(localPath)) return localPath;
57125
+ const localPath = path6.join(SRC_DIR, "sdk.js");
57126
+ if (fs5.existsSync(localPath)) return localPath;
56961
57127
  return null;
56962
57128
  }
56963
57129
 
@@ -56967,20 +57133,20 @@ var include = require_lib11();
56967
57133
  async function processHtml({ verbose = false } = {}) {
56968
57134
  const startTime = Date.now();
56969
57135
  try {
56970
- if (!fs3.existsSync(TEMP_DIR)) {
56971
- fs3.mkdirSync(TEMP_DIR, { recursive: true });
57136
+ if (!fs6.existsSync(TEMP_DIR)) {
57137
+ fs6.mkdirSync(TEMP_DIR, { recursive: true });
56972
57138
  }
56973
57139
  const sdkPath = findSdkPath();
56974
57140
  if (sdkPath) {
56975
57141
  try {
56976
- if (fs3.existsSync(FILES.tempSdk) || fs3.lstatSync(FILES.tempSdk, { throwIfNoEntry: false })) {
56977
- fs3.unlinkSync(FILES.tempSdk);
57142
+ if (fs6.existsSync(FILES.tempSdk) || fs6.lstatSync(FILES.tempSdk, { throwIfNoEntry: false })) {
57143
+ fs6.unlinkSync(FILES.tempSdk);
56978
57144
  }
56979
57145
  if (process.env.LOCALE_SDK_PATH) {
56980
- fs3.symlinkSync(sdkPath, FILES.tempSdk);
57146
+ fs6.symlinkSync(sdkPath, FILES.tempSdk);
56981
57147
  if (verbose) console.log(` SDK symlinked from: ${sdkPath}`);
56982
57148
  } else {
56983
- fs3.copyFileSync(sdkPath, FILES.tempSdk);
57149
+ fs6.copyFileSync(sdkPath, FILES.tempSdk);
56984
57150
  if (verbose) console.log(` SDK copied from: ${sdkPath}`);
56985
57151
  }
56986
57152
  } catch (err) {
@@ -56989,17 +57155,17 @@ async function processHtml({ verbose = false } = {}) {
56989
57155
  } else {
56990
57156
  console.warn("\u26A0\uFE0F SDK not found. Dev mode might not work correctly.");
56991
57157
  }
56992
- if (!fs3.existsSync(FILES.inputHtml)) {
57158
+ if (!fs6.existsSync(FILES.inputHtml)) {
56993
57159
  throw new Error(`Input HTML not found at ${FILES.inputHtml}`);
56994
57160
  }
56995
- const html = fs3.readFileSync(FILES.inputHtml, "utf-8");
57161
+ const html = fs6.readFileSync(FILES.inputHtml, "utf-8");
56996
57162
  const result = await posthtml([
56997
57163
  include({
56998
57164
  root: HTML_SRC_DIR,
56999
57165
  encoding: "utf-8"
57000
57166
  })
57001
57167
  ]).process(html);
57002
- fs3.writeFileSync(FILES.tempHtml, result.html);
57168
+ fs6.writeFileSync(FILES.tempHtml, result.html);
57003
57169
  const duration = Date.now() - startTime;
57004
57170
  const sizeKB = result.html.length / 1024;
57005
57171
  if (verbose) {
@@ -57017,7 +57183,7 @@ async function processHtml({ verbose = false } = {}) {
57017
57183
  }
57018
57184
 
57019
57185
  // src/commands/bundle.ts
57020
- var fs4 = __toESM(require("fs"));
57186
+ var fs7 = __toESM(require("fs"));
57021
57187
  var DEBUG_ENABLED = true;
57022
57188
  var log = (...args2) => DEBUG_ENABLED && console.log("[Builder]", ...args2);
57023
57189
  var logInfo = (...args2) => DEBUG_ENABLED && console.log(...args2);
@@ -57027,26 +57193,26 @@ function bundle() {
57027
57193
  logInfo("\u{1F3D7}\uFE0F Construyendo archivo \xFAnico HTML (Local\xE9 Builder)...");
57028
57194
  log(`\u{1F4C2} CWD: ${CWD}`);
57029
57195
  try {
57030
- if (!fs4.existsSync(BUILD_DIR)) {
57031
- fs4.mkdirSync(BUILD_DIR, { recursive: true });
57196
+ if (!fs7.existsSync(BUILD_DIR)) {
57197
+ fs7.mkdirSync(BUILD_DIR, { recursive: true });
57032
57198
  }
57033
- if (!fs4.existsSync(FILES.tempHtml)) {
57199
+ if (!fs7.existsSync(FILES.tempHtml)) {
57034
57200
  throw new Error(
57035
57201
  `No se encontr\xF3 el archivo HTML procesado: ${FILES.tempHtml}. Aseg\xFArate de ejecutar 'process-html' primero.`
57036
57202
  );
57037
57203
  }
57038
- let htmlContent = fs4.readFileSync(FILES.tempHtml, "utf8");
57204
+ let htmlContent = fs7.readFileSync(FILES.tempHtml, "utf8");
57039
57205
  let cssContent = "";
57040
- if (fs4.existsSync(FILES.css)) {
57041
- cssContent = fs4.readFileSync(FILES.css, "utf8");
57206
+ if (fs7.existsSync(FILES.css)) {
57207
+ cssContent = fs7.readFileSync(FILES.css, "utf8");
57042
57208
  } else {
57043
57209
  logWarn(
57044
57210
  "No se encontr\xF3 output.css, aseg\xFArate de que Tailwind se haya ejecutado."
57045
57211
  );
57046
57212
  }
57047
57213
  let jsContent = "";
57048
- if (fs4.existsSync(FILES.js)) {
57049
- jsContent = fs4.readFileSync(FILES.js, "utf8");
57214
+ if (fs7.existsSync(FILES.js)) {
57215
+ jsContent = fs7.readFileSync(FILES.js, "utf8");
57050
57216
  } else {
57051
57217
  logWarn(
57052
57218
  "No se encontr\xF3 alpine.js, aseg\xFArate de que esbuild se haya ejecutado."
@@ -57056,7 +57222,7 @@ function bundle() {
57056
57222
  const sdkPath = findSdkPath();
57057
57223
  if (sdkPath) {
57058
57224
  log(`\u{1F4CD} SDK Path encontrado: ${sdkPath}`);
57059
- sdkContent = fs4.readFileSync(sdkPath, "utf8");
57225
+ sdkContent = fs7.readFileSync(sdkPath, "utf8");
57060
57226
  logInfo("\u2705 SDK cargado correctamente");
57061
57227
  } else {
57062
57228
  logWarn(
@@ -57110,7 +57276,7 @@ ${bodyClose}` + htmlContent.substring(bodyIdx + bodyClose.length);
57110
57276
  } else {
57111
57277
  htmlContent += `${scripts}`;
57112
57278
  }
57113
- fs4.writeFileSync(FILES.outputHtml, htmlContent);
57279
+ fs7.writeFileSync(FILES.outputHtml, htmlContent);
57114
57280
  logInfo(`\u2705 Build completado exitosamente en: ${FILES.outputHtml}`);
57115
57281
  } catch (error) {
57116
57282
  logError("Error en build:", error);
@@ -57149,14 +57315,17 @@ async function build2() {
57149
57315
  }
57150
57316
  console.log("\u{1F3A8} Building CSS...");
57151
57317
  try {
57152
- const tailwindCmd = (0, import_child_process2.spawnSync)(
57153
- "bunx",
57154
- ["tailwindcss", "-i", FILES.inputCss, "-o", FILES.css, "--minify"],
57155
- {
57156
- stdio: "inherit",
57157
- cwd: process.cwd()
57158
- }
57159
- );
57318
+ const { cmd, args: args2 } = tailwindCommand([
57319
+ "-i",
57320
+ FILES.inputCss,
57321
+ "-o",
57322
+ FILES.css,
57323
+ "--minify"
57324
+ ]);
57325
+ const tailwindCmd = (0, import_child_process4.spawnSync)(cmd, args2, {
57326
+ stdio: "inherit",
57327
+ cwd: process.cwd()
57328
+ });
57160
57329
  if (tailwindCmd.status !== 0) {
57161
57330
  throw new Error("Tailwind CLI failed");
57162
57331
  }
@@ -57172,8 +57341,8 @@ async function build2() {
57172
57341
 
57173
57342
  // src/commands/dev.ts
57174
57343
  var esbuild2 = __toESM(require("esbuild"));
57175
- var import_child_process3 = require("child_process");
57176
- var fs5 = __toESM(require("fs"));
57344
+ var import_child_process5 = require("child_process");
57345
+ var fs8 = __toESM(require("fs"));
57177
57346
  var bundleTimeout = null;
57178
57347
  function debouncedBundle(trigger) {
57179
57348
  console.log(`[dev] \u{1F504} Bundle triggered by: ${trigger}`);
@@ -57197,7 +57366,7 @@ async function dev() {
57197
57366
  console.log("[dev] Initial build done.");
57198
57367
  console.log(" Watching HTML...");
57199
57368
  console.log(`[dev] Watching HTML dir: ${HTML_SRC_DIR}`);
57200
- fs5.watch(HTML_SRC_DIR, { recursive: true }, async (eventType, filename) => {
57369
+ fs8.watch(HTML_SRC_DIR, { recursive: true }, async (eventType, filename) => {
57201
57370
  console.log(
57202
57371
  `[dev] HTML watcher fired: event=${eventType}, file=${filename}`
57203
57372
  );
@@ -57231,23 +57400,20 @@ async function dev() {
57231
57400
  });
57232
57401
  await ctx.watch();
57233
57402
  console.log(" Watching CSS...");
57234
- const tailwindProcess = (0, import_child_process3.spawn)(
57235
- "bunx",
57236
- ["tailwindcss", "-i", FILES.inputCss, "-o", FILES.css, "--watch"],
57237
- {
57238
- stdio: "inherit",
57239
- cwd: process.cwd()
57240
- }
57241
- );
57242
- if (fs5.existsSync(FILES.css)) {
57243
- fs5.watch(FILES.css, () => {
57403
+ const tw = tailwindCommand(["-i", FILES.inputCss, "-o", FILES.css, "--watch"]);
57404
+ const tailwindProcess = (0, import_child_process5.spawn)(tw.cmd, tw.args, {
57405
+ stdio: "inherit",
57406
+ cwd: process.cwd()
57407
+ });
57408
+ if (fs8.existsSync(FILES.css)) {
57409
+ fs8.watch(FILES.css, () => {
57244
57410
  debouncedBundle("css-change");
57245
57411
  });
57246
57412
  } else {
57247
57413
  const checkInterval = setInterval(() => {
57248
- if (fs5.existsSync(FILES.css)) {
57414
+ if (fs8.existsSync(FILES.css)) {
57249
57415
  clearInterval(checkInterval);
57250
- fs5.watch(FILES.css, () => {
57416
+ fs8.watch(FILES.css, () => {
57251
57417
  debouncedBundle("css-change");
57252
57418
  });
57253
57419
  }
@@ -57272,10 +57438,25 @@ async function main() {
57272
57438
  args: flagArgs,
57273
57439
  options: {
57274
57440
  "supabase-url": { type: "string" },
57275
- "api-key": { type: "string" }
57441
+ "api-key": { type: "string" },
57442
+ env: { type: "string" }
57276
57443
  },
57277
57444
  strict: false
57278
57445
  });
57446
+ const envFlag = typeof options.env === "string" ? options.env : void 0;
57447
+ if (envFlag) {
57448
+ if (envFlag !== "dev" && envFlag !== "prod") {
57449
+ console.error(`\u274C --env must be dev|prod (got: ${envFlag})`);
57450
+ process.exit(1);
57451
+ }
57452
+ if (!loadEnvFile(envFlag)) {
57453
+ console.error(
57454
+ `\u274C Missing .env.${envFlag} file. Copy from .env.${envFlag}.example and fill in values.`
57455
+ );
57456
+ process.exit(1);
57457
+ }
57458
+ process.env.DEPLOY_ENV = envFlag;
57459
+ }
57279
57460
  switch (command) {
57280
57461
  case "build":
57281
57462
  await build2();
@@ -57283,6 +57464,12 @@ async function main() {
57283
57464
  case "dev":
57284
57465
  await dev();
57285
57466
  break;
57467
+ case "check":
57468
+ check();
57469
+ break;
57470
+ case "deploy-functions":
57471
+ deployFunctions();
57472
+ break;
57286
57473
  case "deploy": {
57287
57474
  const url = options["supabase-url"];
57288
57475
  const apiKey = options["api-key"];
@@ -57290,6 +57477,9 @@ async function main() {
57290
57477
  functionsUrl: typeof url === "string" ? url : void 0,
57291
57478
  apiKey: typeof apiKey === "string" ? apiKey : void 0
57292
57479
  };
57480
+ if (envFlag) {
57481
+ deployFunctions();
57482
+ }
57293
57483
  await deploy(deployOpts);
57294
57484
  break;
57295
57485
  }
@@ -57298,9 +57488,10 @@ async function main() {
57298
57488
  break;
57299
57489
  default:
57300
57490
  console.log(
57301
- "Usage: locale-miniapp-builder [build|dev|deploy|bump-version]"
57491
+ "Usage: locale-miniapp-builder [build|dev|check|deploy|deploy-functions|bump-version]"
57302
57492
  );
57303
57493
  console.log(" deploy options:");
57494
+ console.log(" --env <dev|prod> (loads .env.<env>, deploys functions + html)");
57304
57495
  console.log(" --supabase-url <url>");
57305
57496
  console.log(" --api-key <key>");
57306
57497
  break;