@plasmicapp/cli 0.1.336 → 0.1.338
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/actions/export.d.ts +1 -1
- package/dist/actions/init.d.ts +1 -1
- package/dist/index.js +153 -63
- package/dist/lib.js +109 -19
- package/dist/plasmic.schema.json +15 -1
- package/dist/utils/config-utils.d.ts +13 -1
- package/dist/utils/envdetect.d.ts +1 -0
- package/dist/utils/file-utils.d.ts +1 -1
- package/dist/utils/rsc-config.d.ts +3 -1
- package/package.json +2 -2
- package/src/__tests__/file-utils.spec.ts +47 -0
- package/src/actions/export.ts +1 -1
- package/src/actions/init.ts +51 -4
- package/src/actions/sync-components.ts +23 -1
- package/src/utils/code-utils.ts +10 -2
- package/src/utils/config-utils.ts +17 -2
- package/src/utils/envdetect.ts +9 -0
- package/src/utils/file-utils.ts +29 -3
- package/src/utils/rsc-config.ts +14 -9
package/dist/actions/export.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CommonArgs } from "..";
|
|
|
2
2
|
import { I18NConfig } from "../utils/config-utils";
|
|
3
3
|
export interface ExportArgs extends CommonArgs {
|
|
4
4
|
projects: readonly string[];
|
|
5
|
-
platform: "" | "react" | "nextjs" | "gatsby";
|
|
5
|
+
platform: "" | "react" | "nextjs" | "gatsby" | "tanstack";
|
|
6
6
|
codeLang: "" | "ts" | "js";
|
|
7
7
|
styleScheme: "" | "css" | "css-modules";
|
|
8
8
|
imagesScheme: "" | "inlined" | "files";
|
package/dist/actions/init.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonArgs } from "..";
|
|
2
2
|
export interface InitArgs extends CommonArgs {
|
|
3
3
|
host: string;
|
|
4
|
-
platform: "" | "react" | "nextjs" | "gatsby";
|
|
4
|
+
platform: "" | "react" | "nextjs" | "gatsby" | "tanstack";
|
|
5
5
|
codeLang: "" | "ts" | "js";
|
|
6
6
|
codeScheme: "" | "blackbox";
|
|
7
7
|
styleScheme: "" | "css" | "css-modules";
|
package/dist/index.js
CHANGED
|
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// node_modules/yargs/build/lib/common-types.js
|
|
38
38
|
var require_common_types = __commonJS({
|
|
39
|
-
"
|
|
39
|
+
"node_modules/yargs/build/lib/common-types.js"(exports) {
|
|
40
40
|
"use strict";
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.objectKeys = exports.assertSingleKey = exports.assertNotStrictEqual = void 0;
|
|
@@ -56,9 +56,9 @@ var require_common_types = __commonJS({
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
//
|
|
59
|
+
// node_modules/yargs/build/lib/is-promise.js
|
|
60
60
|
var require_is_promise = __commonJS({
|
|
61
|
-
"
|
|
61
|
+
"node_modules/yargs/build/lib/is-promise.js"(exports) {
|
|
62
62
|
"use strict";
|
|
63
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
64
|
exports.isPromise = void 0;
|
|
@@ -69,9 +69,9 @@ var require_is_promise = __commonJS({
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
// node_modules/yargs/build/lib/yerror.js
|
|
73
73
|
var require_yerror = __commonJS({
|
|
74
|
-
"
|
|
74
|
+
"node_modules/yargs/build/lib/yerror.js"(exports) {
|
|
75
75
|
"use strict";
|
|
76
76
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
77
|
exports.YError = void 0;
|
|
@@ -86,9 +86,9 @@ var require_yerror = __commonJS({
|
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
//
|
|
89
|
+
// node_modules/yargs/build/lib/parse-command.js
|
|
90
90
|
var require_parse_command = __commonJS({
|
|
91
|
-
"
|
|
91
|
+
"node_modules/yargs/build/lib/parse-command.js"(exports) {
|
|
92
92
|
"use strict";
|
|
93
93
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
94
94
|
exports.parseCommand = void 0;
|
|
@@ -127,9 +127,9 @@ var require_parse_command = __commonJS({
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
//
|
|
130
|
+
// node_modules/yargs/build/lib/argsert.js
|
|
131
131
|
var require_argsert = __commonJS({
|
|
132
|
-
"
|
|
132
|
+
"node_modules/yargs/build/lib/argsert.js"(exports) {
|
|
133
133
|
"use strict";
|
|
134
134
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
135
135
|
exports.argsert = void 0;
|
|
@@ -191,9 +191,9 @@ var require_argsert = __commonJS({
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
//
|
|
194
|
+
// node_modules/yargs/build/lib/middleware.js
|
|
195
195
|
var require_middleware = __commonJS({
|
|
196
|
-
"
|
|
196
|
+
"node_modules/yargs/build/lib/middleware.js"(exports) {
|
|
197
197
|
"use strict";
|
|
198
198
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
199
199
|
exports.applyMiddleware = exports.commandMiddlewareFactory = exports.globalMiddlewareFactory = void 0;
|
|
@@ -399,9 +399,9 @@ var require_decamelize = __commonJS({
|
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
401
|
|
|
402
|
-
//
|
|
402
|
+
// node_modules/yargs-parser/lib/tokenize-arg-string.js
|
|
403
403
|
var require_tokenize_arg_string = __commonJS({
|
|
404
|
-
"
|
|
404
|
+
"node_modules/yargs-parser/lib/tokenize-arg-string.js"(exports, module2) {
|
|
405
405
|
module2.exports = function(argString) {
|
|
406
406
|
if (Array.isArray(argString)) {
|
|
407
407
|
return argString.map((e) => typeof e !== "string" ? e + "" : e);
|
|
@@ -435,9 +435,9 @@ var require_tokenize_arg_string = __commonJS({
|
|
|
435
435
|
}
|
|
436
436
|
});
|
|
437
437
|
|
|
438
|
-
//
|
|
438
|
+
// node_modules/yargs-parser/index.js
|
|
439
439
|
var require_yargs_parser = __commonJS({
|
|
440
|
-
"
|
|
440
|
+
"node_modules/yargs-parser/index.js"(exports, module2) {
|
|
441
441
|
var camelCase = require_camelcase();
|
|
442
442
|
var decamelize = require_decamelize();
|
|
443
443
|
var path15 = require("path");
|
|
@@ -1226,9 +1226,9 @@ var require_yargs_parser = __commonJS({
|
|
|
1226
1226
|
}
|
|
1227
1227
|
});
|
|
1228
1228
|
|
|
1229
|
-
//
|
|
1229
|
+
// node_modules/yargs/build/lib/command.js
|
|
1230
1230
|
var require_command = __commonJS({
|
|
1231
|
-
"
|
|
1231
|
+
"node_modules/yargs/build/lib/command.js"(exports) {
|
|
1232
1232
|
"use strict";
|
|
1233
1233
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1234
1234
|
exports.isCommandBuilderCallback = exports.isCommandBuilderDefinition = exports.isCommandHandlerDefinition = exports.command = void 0;
|
|
@@ -1589,9 +1589,9 @@ var require_command = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
});
|
|
1591
1591
|
|
|
1592
|
-
//
|
|
1592
|
+
// node_modules/yargs/build/lib/obj-filter.js
|
|
1593
1593
|
var require_obj_filter = __commonJS({
|
|
1594
|
-
"
|
|
1594
|
+
"node_modules/yargs/build/lib/obj-filter.js"(exports) {
|
|
1595
1595
|
"use strict";
|
|
1596
1596
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1597
1597
|
exports.objFilter = void 0;
|
|
@@ -2826,9 +2826,9 @@ var require_ansi_styles = __commonJS({
|
|
|
2826
2826
|
}
|
|
2827
2827
|
});
|
|
2828
2828
|
|
|
2829
|
-
//
|
|
2829
|
+
// node_modules/cliui/node_modules/wrap-ansi/index.js
|
|
2830
2830
|
var require_wrap_ansi = __commonJS({
|
|
2831
|
-
"
|
|
2831
|
+
"node_modules/cliui/node_modules/wrap-ansi/index.js"(exports, module2) {
|
|
2832
2832
|
"use strict";
|
|
2833
2833
|
var stringWidth = require_string_width();
|
|
2834
2834
|
var stripAnsi = require_strip_ansi();
|
|
@@ -2959,9 +2959,9 @@ var require_wrap_ansi = __commonJS({
|
|
|
2959
2959
|
}
|
|
2960
2960
|
});
|
|
2961
2961
|
|
|
2962
|
-
//
|
|
2962
|
+
// node_modules/cliui/index.js
|
|
2963
2963
|
var require_cliui = __commonJS({
|
|
2964
|
-
"
|
|
2964
|
+
"node_modules/cliui/index.js"(exports, module2) {
|
|
2965
2965
|
"use strict";
|
|
2966
2966
|
var stringWidth = require_string_width();
|
|
2967
2967
|
var stripAnsi = require_strip_ansi();
|
|
@@ -3221,9 +3221,9 @@ var require_cliui = __commonJS({
|
|
|
3221
3221
|
}
|
|
3222
3222
|
});
|
|
3223
3223
|
|
|
3224
|
-
//
|
|
3224
|
+
// node_modules/yargs/build/lib/usage.js
|
|
3225
3225
|
var require_usage = __commonJS({
|
|
3226
|
-
"
|
|
3226
|
+
"node_modules/yargs/build/lib/usage.js"(exports) {
|
|
3227
3227
|
"use strict";
|
|
3228
3228
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3229
3229
|
exports.usage = void 0;
|
|
@@ -3701,9 +3701,9 @@ var require_usage = __commonJS({
|
|
|
3701
3701
|
}
|
|
3702
3702
|
});
|
|
3703
3703
|
|
|
3704
|
-
//
|
|
3704
|
+
// node_modules/yargs/build/lib/completion-templates.js
|
|
3705
3705
|
var require_completion_templates = __commonJS({
|
|
3706
|
-
"
|
|
3706
|
+
"node_modules/yargs/build/lib/completion-templates.js"(exports) {
|
|
3707
3707
|
"use strict";
|
|
3708
3708
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3709
3709
|
exports.completionZshTemplate = exports.completionShTemplate = void 0;
|
|
@@ -3758,9 +3758,9 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
|
3758
3758
|
}
|
|
3759
3759
|
});
|
|
3760
3760
|
|
|
3761
|
-
//
|
|
3761
|
+
// node_modules/yargs/build/lib/completion.js
|
|
3762
3762
|
var require_completion = __commonJS({
|
|
3763
|
-
"
|
|
3763
|
+
"node_modules/yargs/build/lib/completion.js"(exports) {
|
|
3764
3764
|
"use strict";
|
|
3765
3765
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3766
3766
|
exports.completion = void 0;
|
|
@@ -3884,9 +3884,9 @@ var require_completion = __commonJS({
|
|
|
3884
3884
|
}
|
|
3885
3885
|
});
|
|
3886
3886
|
|
|
3887
|
-
//
|
|
3887
|
+
// node_modules/yargs/build/lib/levenshtein.js
|
|
3888
3888
|
var require_levenshtein = __commonJS({
|
|
3889
|
-
"
|
|
3889
|
+
"node_modules/yargs/build/lib/levenshtein.js"(exports) {
|
|
3890
3890
|
"use strict";
|
|
3891
3891
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3892
3892
|
exports.levenshtein = void 0;
|
|
@@ -3927,9 +3927,9 @@ var require_levenshtein = __commonJS({
|
|
|
3927
3927
|
}
|
|
3928
3928
|
});
|
|
3929
3929
|
|
|
3930
|
-
//
|
|
3930
|
+
// node_modules/yargs/build/lib/validation.js
|
|
3931
3931
|
var require_validation = __commonJS({
|
|
3932
|
-
"
|
|
3932
|
+
"node_modules/yargs/build/lib/validation.js"(exports) {
|
|
3933
3933
|
"use strict";
|
|
3934
3934
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3935
3935
|
exports.validation = void 0;
|
|
@@ -4226,9 +4226,9 @@ ${customMsgs.join("\n")}` : "";
|
|
|
4226
4226
|
}
|
|
4227
4227
|
});
|
|
4228
4228
|
|
|
4229
|
-
//
|
|
4229
|
+
// node_modules/yargs/build/lib/apply-extends.js
|
|
4230
4230
|
var require_apply_extends = __commonJS({
|
|
4231
|
-
"
|
|
4231
|
+
"node_modules/yargs/build/lib/apply-extends.js"(exports) {
|
|
4232
4232
|
"use strict";
|
|
4233
4233
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4234
4234
|
exports.applyExtends = void 0;
|
|
@@ -4291,9 +4291,9 @@ var require_apply_extends = __commonJS({
|
|
|
4291
4291
|
}
|
|
4292
4292
|
});
|
|
4293
4293
|
|
|
4294
|
-
//
|
|
4294
|
+
// node_modules/yargs/build/lib/process-argv.js
|
|
4295
4295
|
var require_process_argv = __commonJS({
|
|
4296
|
-
"
|
|
4296
|
+
"node_modules/yargs/build/lib/process-argv.js"(exports) {
|
|
4297
4297
|
"use strict";
|
|
4298
4298
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4299
4299
|
exports.getProcessArgvBin = exports.getProcessArgvWithoutBin = void 0;
|
|
@@ -4784,9 +4784,9 @@ var require_get_caller_file = __commonJS({
|
|
|
4784
4784
|
}
|
|
4785
4785
|
});
|
|
4786
4786
|
|
|
4787
|
-
//
|
|
4787
|
+
// node_modules/yargs/build/lib/yargs.js
|
|
4788
4788
|
var require_yargs = __commonJS({
|
|
4789
|
-
"
|
|
4789
|
+
"node_modules/yargs/build/lib/yargs.js"(exports) {
|
|
4790
4790
|
"use strict";
|
|
4791
4791
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4792
4792
|
exports.isYargsInstance = exports.rebase = exports.Yargs = void 0;
|
|
@@ -5862,9 +5862,9 @@ var require_yargs = __commonJS({
|
|
|
5862
5862
|
}
|
|
5863
5863
|
});
|
|
5864
5864
|
|
|
5865
|
-
//
|
|
5865
|
+
// node_modules/yargs/yargs.js
|
|
5866
5866
|
var require_yargs2 = __commonJS({
|
|
5867
|
-
"
|
|
5867
|
+
"node_modules/yargs/yargs.js"(exports, module2) {
|
|
5868
5868
|
"use strict";
|
|
5869
5869
|
async function requiresNode8OrGreater() {
|
|
5870
5870
|
}
|
|
@@ -5877,9 +5877,9 @@ var require_yargs2 = __commonJS({
|
|
|
5877
5877
|
}
|
|
5878
5878
|
});
|
|
5879
5879
|
|
|
5880
|
-
//
|
|
5880
|
+
// node_modules/yargs/index.js
|
|
5881
5881
|
var require_yargs3 = __commonJS({
|
|
5882
|
-
"
|
|
5882
|
+
"node_modules/yargs/index.js"(exports, module2) {
|
|
5883
5883
|
"use strict";
|
|
5884
5884
|
var yargs2 = require_yargs2();
|
|
5885
5885
|
var processArgv = require_process_argv();
|
|
@@ -499222,6 +499222,9 @@ function makeImportPath(context, fromPath, toPath, stripExt, forceRelative = fal
|
|
|
499222
499222
|
if (stripExt) {
|
|
499223
499223
|
result = stripExtension(result);
|
|
499224
499224
|
}
|
|
499225
|
+
if (result.endsWith(".css") && context.config.platform === "tanstack" && context.config.style.scheme === "css") {
|
|
499226
|
+
result = `${result}?url`;
|
|
499227
|
+
}
|
|
499225
499228
|
return result;
|
|
499226
499229
|
}
|
|
499227
499230
|
function isLocalModulePath(modulePath) {
|
|
@@ -499536,7 +499539,6 @@ async function fixRscModulesImports(context, baseDir, fixImportContext, compConf
|
|
|
499536
499539
|
if (!modulePath) {
|
|
499537
499540
|
continue;
|
|
499538
499541
|
}
|
|
499539
|
-
logger.info(`Fixing rsc import statements... ${modulePath}`);
|
|
499540
499542
|
try {
|
|
499541
499543
|
await fixFileImportStatements(
|
|
499542
499544
|
context,
|
|
@@ -499627,7 +499629,7 @@ function defaultPublicResourcePath(context, project, ...subpaths) {
|
|
|
499627
499629
|
var INDEX_EXT_REGEXP = /\/index\.(jsx|tsx)$/;
|
|
499628
499630
|
var EXT_REGEXP = /\.(jsx|tsx)$/;
|
|
499629
499631
|
function defaultPagePath(context, fileName) {
|
|
499630
|
-
var _a, _b, _c, _d;
|
|
499632
|
+
var _a, _b, _c, _d, _e;
|
|
499631
499633
|
if (context.config.platform === "nextjs") {
|
|
499632
499634
|
if ((_b = (_a = context.config.nextjsConfig) == null ? void 0 : _a.pagesDir) == null ? void 0 : _b.endsWith("app")) {
|
|
499633
499635
|
const matchesIndex = fileName.match(INDEX_EXT_REGEXP);
|
|
@@ -499647,6 +499649,16 @@ function defaultPagePath(context, fileName) {
|
|
|
499647
499649
|
}
|
|
499648
499650
|
} else if (context.config.platform === "gatsby") {
|
|
499649
499651
|
return import_upath3.default.join(((_d = context.config.gatsbyConfig) == null ? void 0 : _d.pagesDir) || "", fileName);
|
|
499652
|
+
} else if (context.config.platform === "tanstack") {
|
|
499653
|
+
let renamedFileName = fileName.replace(/\[(\w+)\]/g, "$$$1");
|
|
499654
|
+
const matchesIndex = fileName.match(INDEX_EXT_REGEXP);
|
|
499655
|
+
if (!matchesIndex) {
|
|
499656
|
+
renamedFileName = renamedFileName.replace(EXT_REGEXP, "/index.$1");
|
|
499657
|
+
}
|
|
499658
|
+
return import_upath3.default.join(
|
|
499659
|
+
((_e = context.config.tanstackConfig) == null ? void 0 : _e.pagesDir) || "",
|
|
499660
|
+
renamedFileName
|
|
499661
|
+
);
|
|
499650
499662
|
} else {
|
|
499651
499663
|
return fileName;
|
|
499652
499664
|
}
|
|
@@ -499793,6 +499805,9 @@ function getAllPaths(context) {
|
|
|
499793
499805
|
if (config.nextjsConfig) {
|
|
499794
499806
|
pushPath(config.nextjsConfig, "pagesDir");
|
|
499795
499807
|
}
|
|
499808
|
+
if (config.tanstackConfig) {
|
|
499809
|
+
pushPath(config.tanstackConfig, "pagesDir");
|
|
499810
|
+
}
|
|
499796
499811
|
return pairs;
|
|
499797
499812
|
}
|
|
499798
499813
|
function assertAllPathsInRootDir(context) {
|
|
@@ -499861,11 +499876,15 @@ function readFileText(path15) {
|
|
|
499861
499876
|
case "create":
|
|
499862
499877
|
return ensureString(action.content);
|
|
499863
499878
|
case "rename":
|
|
499864
|
-
return
|
|
499879
|
+
return import_fs.default.readFileSync(path15, "utf8");
|
|
499865
499880
|
case "delete":
|
|
499866
499881
|
throw new HandledError("File does not exists");
|
|
499867
499882
|
}
|
|
499868
499883
|
}
|
|
499884
|
+
const renamedFilePath = renamedFiles.get(path15);
|
|
499885
|
+
if (renamedFilePath) {
|
|
499886
|
+
return readFileText(renamedFilePath);
|
|
499887
|
+
}
|
|
499869
499888
|
}
|
|
499870
499889
|
return import_fs.default.readFileSync(path15, "utf8");
|
|
499871
499890
|
}
|
|
@@ -500287,7 +500306,7 @@ function getOrAddProjectLock(context, projectId, branchName, base) {
|
|
|
500287
500306
|
return project;
|
|
500288
500307
|
}
|
|
500289
500308
|
function isPageAwarePlatform(platform) {
|
|
500290
|
-
return platform === "nextjs" || platform === "gatsby";
|
|
500309
|
+
return platform === "nextjs" || platform === "gatsby" || platform === "tanstack";
|
|
500291
500310
|
}
|
|
500292
500311
|
|
|
500293
500312
|
// src/api.ts
|
|
@@ -500823,6 +500842,14 @@ function detectCreateReactApp() {
|
|
|
500823
500842
|
return false;
|
|
500824
500843
|
}
|
|
500825
500844
|
}
|
|
500845
|
+
function detectTanStackApp() {
|
|
500846
|
+
try {
|
|
500847
|
+
const packageJsonContent = getParsedPackageJson();
|
|
500848
|
+
return "@tanstack/react-router" in packageJsonContent.dependencies;
|
|
500849
|
+
} catch {
|
|
500850
|
+
return false;
|
|
500851
|
+
}
|
|
500852
|
+
}
|
|
500826
500853
|
|
|
500827
500854
|
// src/actions/init.ts
|
|
500828
500855
|
async function initPlasmic(opts) {
|
|
@@ -500865,13 +500892,22 @@ function createInitConfig(opts) {
|
|
|
500865
500892
|
pagesDir: opts.pagesDir
|
|
500866
500893
|
}
|
|
500867
500894
|
},
|
|
500895
|
+
...opts.platform === "tanstack" && {
|
|
500896
|
+
tanstackConfig: {
|
|
500897
|
+
pagesDir: opts.pagesDir
|
|
500898
|
+
}
|
|
500899
|
+
},
|
|
500868
500900
|
code: {
|
|
500869
500901
|
...opts.codeLang && { lang: opts.codeLang },
|
|
500870
500902
|
...opts.codeScheme && { scheme: opts.codeScheme },
|
|
500871
500903
|
...opts.reactRuntime && { reactRuntime: opts.reactRuntime }
|
|
500872
500904
|
},
|
|
500873
500905
|
style: {
|
|
500874
|
-
...opts.styleScheme && {
|
|
500906
|
+
...opts.styleScheme && {
|
|
500907
|
+
// Css Modules is not supported yet in SSR for TanStack
|
|
500908
|
+
// https://github.com/TanStack/router/issues/3023
|
|
500909
|
+
scheme: opts.platform === "tanstack" ? "css" : opts.styleScheme
|
|
500910
|
+
}
|
|
500875
500911
|
},
|
|
500876
500912
|
images: {
|
|
500877
500913
|
...opts.imagesScheme && { scheme: opts.imagesScheme },
|
|
@@ -500894,12 +500930,13 @@ function simulatePrompt(question, defaultAnswer, bold = false) {
|
|
|
500894
500930
|
}
|
|
500895
500931
|
async function deriveInitAnswers(opts) {
|
|
500896
500932
|
const plasmicRootDir = opts.config ? import_upath5.default.dirname(opts.config) : opts.baseDir;
|
|
500897
|
-
const platform = !!opts.platform ? opts.platform : detectNextJs() ? "nextjs" : detectGatsby() ? "gatsby" : detectCreateReactApp() ? "react" : "";
|
|
500933
|
+
const platform = !!opts.platform ? opts.platform : detectNextJs() ? "nextjs" : detectGatsby() ? "gatsby" : detectTanStackApp() ? "tanstack" : detectCreateReactApp() ? "react" : "";
|
|
500898
500934
|
const isCra = platform === "react";
|
|
500899
500935
|
const isNext = platform === "nextjs";
|
|
500900
500936
|
const isNextAppDir = isNext && detectNextJsAppDir();
|
|
500901
500937
|
const isGatsby = platform === "gatsby";
|
|
500902
|
-
const
|
|
500938
|
+
const isTanStack = platform === "tanstack";
|
|
500939
|
+
const isGeneric = !isCra && !isNext && !isGatsby && !isTanStack;
|
|
500903
500940
|
const isTypescript = detectTypescript();
|
|
500904
500941
|
if (isNext) {
|
|
500905
500942
|
if (isNextAppDir) {
|
|
@@ -500909,10 +500946,12 @@ async function deriveInitAnswers(opts) {
|
|
|
500909
500946
|
}
|
|
500910
500947
|
} else if (isGatsby) {
|
|
500911
500948
|
logger.info("Detected Gatsby...");
|
|
500949
|
+
} else if (isTanStack) {
|
|
500950
|
+
logger.info("Detected TanStack router app...");
|
|
500912
500951
|
} else if (isCra) {
|
|
500913
500952
|
logger.info("Detected create-react-app...");
|
|
500914
500953
|
}
|
|
500915
|
-
const deriver = isNext ? getNextDefaults(plasmicRootDir, isNextAppDir) : isGatsby ? getGatsbyDefaults(plasmicRootDir) : isCra ? getCraDefaults(plasmicRootDir) : getGenericDefaults(plasmicRootDir);
|
|
500954
|
+
const deriver = isNext ? getNextDefaults(plasmicRootDir, isNextAppDir) : isGatsby ? getGatsbyDefaults(plasmicRootDir) : isTanStack ? getTanStackDefaults(plasmicRootDir) : isCra ? getCraDefaults(plasmicRootDir) : getGenericDefaults(plasmicRootDir);
|
|
500916
500955
|
const srcDir = ensureString(deriver.srcDir);
|
|
500917
500956
|
const getDefaultAnswer = (name, defaultAnswer) => {
|
|
500918
500957
|
if (opts[name]) {
|
|
@@ -501149,6 +501188,35 @@ function getGatsbyDefaults(plasmicRootDir) {
|
|
|
501149
501188
|
alwaysDerived: ["imagesScheme", "pagesDir"]
|
|
501150
501189
|
};
|
|
501151
501190
|
}
|
|
501191
|
+
function getTanStackDefaults(plasmicRootDir) {
|
|
501192
|
+
var _a;
|
|
501193
|
+
const projectRootDir = (_a = findPackageJsonDir(plasmicRootDir)) != null ? _a : plasmicRootDir;
|
|
501194
|
+
return {
|
|
501195
|
+
srcDir: import_upath5.default.relative(
|
|
501196
|
+
plasmicRootDir,
|
|
501197
|
+
import_upath5.default.join(projectRootDir, "src", "components")
|
|
501198
|
+
),
|
|
501199
|
+
pagesDir: (srcDir) => {
|
|
501200
|
+
const absSrcDir = import_upath5.default.join(plasmicRootDir, srcDir);
|
|
501201
|
+
const absPagesDir = import_upath5.default.join(projectRootDir, "src", "routes");
|
|
501202
|
+
const relDir = import_upath5.default.relative(absSrcDir, absPagesDir);
|
|
501203
|
+
return relDir;
|
|
501204
|
+
},
|
|
501205
|
+
styleScheme: "css",
|
|
501206
|
+
imagesScheme: "public-files",
|
|
501207
|
+
imagesPublicDir: (srcDir) => import_upath5.default.relative(
|
|
501208
|
+
import_upath5.default.join(plasmicRootDir, srcDir),
|
|
501209
|
+
import_upath5.default.join(projectRootDir, "public")
|
|
501210
|
+
),
|
|
501211
|
+
imagesPublicUrlPrefix: "/",
|
|
501212
|
+
alwaysDerived: [
|
|
501213
|
+
"styleScheme",
|
|
501214
|
+
"imagesScheme",
|
|
501215
|
+
"imagesPublicDir",
|
|
501216
|
+
"pagesDir"
|
|
501217
|
+
]
|
|
501218
|
+
};
|
|
501219
|
+
}
|
|
501152
501220
|
function getCraDefaults(plasmicRootDir) {
|
|
501153
501221
|
var _a;
|
|
501154
501222
|
const projectRootDir = (_a = findPackageJsonDir(plasmicRootDir)) != null ? _a : plasmicRootDir;
|
|
@@ -501182,7 +501250,7 @@ var INIT_ARGS_DESCRIPTION = {
|
|
|
501182
501250
|
platform: {
|
|
501183
501251
|
shortDescription: "Target platform",
|
|
501184
501252
|
longDescription: "Target platform to generate code for",
|
|
501185
|
-
choices: ["react", "nextjs", "gatsby"]
|
|
501253
|
+
choices: ["react", "nextjs", "gatsby", "tanstack"]
|
|
501186
501254
|
},
|
|
501187
501255
|
codeLang: {
|
|
501188
501256
|
shortDescription: "Target language",
|
|
@@ -502268,7 +502336,7 @@ var import_lodash15 = __toESM(require_lodash());
|
|
|
502268
502336
|
var import_upath9 = __toESM(require_upath());
|
|
502269
502337
|
|
|
502270
502338
|
// src/utils/rsc-config.ts
|
|
502271
|
-
async function syncRscFiles(context, project, bundle, compConfig) {
|
|
502339
|
+
async function syncRscFiles(context, project, bundle, compConfig, opts) {
|
|
502272
502340
|
const rscMetadata = bundle.rscMetadata;
|
|
502273
502341
|
if (rscMetadata) {
|
|
502274
502342
|
if (!compConfig.rsc) {
|
|
@@ -502296,19 +502364,22 @@ async function syncRscFiles(context, project, bundle, compConfig) {
|
|
|
502296
502364
|
"-client.tsx"
|
|
502297
502365
|
);
|
|
502298
502366
|
compConfig.rsc.clientModulePath = clientModuleFilePath;
|
|
502299
|
-
|
|
502300
|
-
|
|
502301
|
-
|
|
502302
|
-
|
|
502303
|
-
|
|
502304
|
-
|
|
502305
|
-
|
|
502306
|
-
|
|
502367
|
+
if (opts.shouldRegenerate) {
|
|
502368
|
+
await writeFileContent(
|
|
502369
|
+
context,
|
|
502370
|
+
clientModuleFilePath,
|
|
502371
|
+
rscMetadata.pageWrappers.client.module,
|
|
502372
|
+
{
|
|
502373
|
+
force: false
|
|
502374
|
+
}
|
|
502375
|
+
);
|
|
502376
|
+
}
|
|
502307
502377
|
}
|
|
502308
502378
|
}
|
|
502309
502379
|
|
|
502310
502380
|
// src/actions/sync-components.ts
|
|
502311
502381
|
async function syncProjectComponents(context, project, version, componentBundles, forceOverwrite, summary, projectLock, checksums, baseDir) {
|
|
502382
|
+
var _a;
|
|
502312
502383
|
const componentsFromChecksums = /* @__PURE__ */ new Set([
|
|
502313
502384
|
...checksums.cssRulesChecksums.map(([id, _]) => id),
|
|
502314
502385
|
checksums.renderModuleChecksums.map(([id, _]) => id)
|
|
@@ -502467,6 +502538,23 @@ async function syncProjectComponents(context, project, version, componentBundles
|
|
|
502467
502538
|
}
|
|
502468
502539
|
renameFile(context, compConfig.importSpec.modulePath, skeletonPath);
|
|
502469
502540
|
compConfig.importSpec.modulePath = skeletonPath;
|
|
502541
|
+
if (((_a = compConfig.rsc) == null ? void 0 : _a.clientModulePath) && fileExists(context, compConfig.rsc.clientModulePath)) {
|
|
502542
|
+
const clientModulePath = skeletonPath.replace(
|
|
502543
|
+
/\.tsx$/,
|
|
502544
|
+
"-client.tsx"
|
|
502545
|
+
);
|
|
502546
|
+
if (context.cliArgs.quiet !== true) {
|
|
502547
|
+
logger.info(
|
|
502548
|
+
`Renaming page file: ${compConfig.rsc.clientModulePath} -> ${clientModulePath} ['${project.projectName}' ${project.projectId}/${id} ${project.version}]`
|
|
502549
|
+
);
|
|
502550
|
+
}
|
|
502551
|
+
renameFile(
|
|
502552
|
+
context,
|
|
502553
|
+
compConfig.rsc.clientModulePath,
|
|
502554
|
+
clientModulePath
|
|
502555
|
+
);
|
|
502556
|
+
compConfig.rsc.clientModulePath = clientModulePath;
|
|
502557
|
+
}
|
|
502470
502558
|
}
|
|
502471
502559
|
compConfig.plumeType = plumeType;
|
|
502472
502560
|
if (scheme === "direct") {
|
|
@@ -502534,7 +502622,9 @@ async function syncProjectComponents(context, project, version, componentBundles
|
|
|
502534
502622
|
);
|
|
502535
502623
|
}
|
|
502536
502624
|
summary.set(id, { skeletonModuleModified });
|
|
502537
|
-
await syncRscFiles(context, project, bundle, compConfig
|
|
502625
|
+
await syncRscFiles(context, project, bundle, compConfig, {
|
|
502626
|
+
shouldRegenerate
|
|
502627
|
+
});
|
|
502538
502628
|
}
|
|
502539
502629
|
}
|
|
502540
502630
|
|