@wasp.sh/wasp-cli-darwin-arm64-unknown 0.23.0 → 0.24.0-rc.3
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/data/Cli/starters/basic/main.wasp.ts +60 -0
- package/data/Cli/starters/basic/package.json +4 -1
- package/data/Cli/starters/basic/prettier.config.mjs +9 -0
- package/data/Cli/starters/basic/src/tags/tags.wasp.ts +8 -0
- package/data/Cli/starters/basic/src/tasks/task.wasp.ts +16 -0
- package/data/Cli/starters/minimal/main.wasp.ts +12 -0
- package/data/Cli/starters/minimal/package.json +4 -1
- package/data/Cli/starters/skeleton/AGENTS.md +23 -0
- package/data/Cli/starters/skeleton/CLAUDE.md +23 -0
- package/data/Cli/starters/skeleton/tsconfig.json +5 -26
- package/data/Cli/starters/{ts-minimal → skeleton}/tsconfig.src.json +2 -1
- package/data/Cli/starters/{ts-minimal → skeleton}/tsconfig.wasp.json +5 -2
- package/data/Generator/libs/auth/{wasp.sh-lib-auth-0.23.0.tgz → wasp.sh-lib-auth-0.24.0.tgz} +0 -0
- package/data/Generator/libs/vite-ssr/{wasp.sh-lib-vite-ssr-0.23.0.tgz → wasp.sh-lib-vite-ssr-0.24.0.tgz} +0 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +51 -47
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +9 -4
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/responseSchemas.ts +10 -0
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +5 -3
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +3 -2
- package/data/Generator/templates/sdk/wasp/client/app/layout.tsx +13 -20
- package/data/Generator/templates/sdk/wasp/client/app/pages/OAuthCallback.tsx +12 -11
- package/data/Generator/templates/sdk/wasp/client/env/schema.ts +8 -8
- package/data/Generator/templates/sdk/wasp/client/env.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +4 -2
- package/data/Generator/templates/sdk/wasp/client/router/NavLink.tsx +21 -0
- package/data/Generator/templates/sdk/wasp/client/router/index.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/typescriptCheck.ts +8 -4
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +72 -44
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/wasp.ts +1 -1
- package/data/Generator/templates/sdk/wasp/tsconfig.json +3 -0
- package/data/Generator/templates/types/spec/register.ts +14 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +9 -0
- package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +47 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/deployment.js +45 -0
- package/data/packages/deploy/package-lock.json +2 -2
- package/data/packages/deploy/package.json +1 -1
- package/data/packages/prisma/package-lock.json +2 -2
- package/data/packages/prisma/package.json +1 -2
- package/data/packages/spec/dist/__tests__/cli.unit.test.js +128 -0
- package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/appAnalyzer.unit.test.js +3 -3
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.integration.test.js +2 -2
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.unit.test.js +4 -18
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.d.ts +4 -4
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.js +2 -2
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.js +68 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +814 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.js +148 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.js +49 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.js +204 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.d.ts +85 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.js +473 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.js +44 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.js +218 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.js +174 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.js +119 -0
- package/data/packages/{wasp-config → spec}/dist/src/appSpec.d.ts +11 -4
- package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -0
- package/data/packages/{wasp-config → spec}/dist/src/cli.d.ts +3 -1
- package/data/packages/spec/dist/src/cli.d.ts.map +1 -0
- package/data/packages/spec/dist/src/cli.js +28 -0
- package/data/packages/spec/dist/src/index.d.ts +2 -0
- package/data/packages/spec/dist/src/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/index.js +1 -0
- package/data/packages/spec/dist/src/internal.d.ts +2 -0
- package/data/packages/spec/dist/src/internal.d.ts.map +1 -0
- package/data/packages/spec/dist/src/internal.js +1 -0
- package/data/packages/spec/dist/src/legacy/_private.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/appAnalyzer.d.ts +1 -1
- package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/mapTsAppSpecToAppSpecDecls.d.ts +1 -1
- package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/mapTsAppSpecToAppSpecDecls.js +3 -6
- package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/tsAppSpec.d.ts +3 -3
- package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/run.js +28 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.d.ts +8 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.js +35 -0
- package/data/packages/spec/dist/src/spec/mapApp.d.ts +54 -0
- package/data/packages/spec/dist/src/spec/mapApp.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapApp.js +336 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +296 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.js +277 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.js +2 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts +9 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.js +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +872 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.js +1 -0
- package/data/packages/spec/dist/src/spec/refObject.d.ts +95 -0
- package/data/packages/spec/dist/src/spec/refObject.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/refObject.js +119 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.d.ts +18 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.js +79 -0
- package/data/packages/spec/dist/src/spec/specUserError.d.ts +9 -0
- package/data/packages/spec/dist/src/spec/specUserError.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/specUserError.js +8 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.d.ts +2 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.js +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.js +46 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.d.ts +4 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.js +34 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.js +14 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.js +40 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.d.ts +26 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.js +57 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.js +8 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.d.ts +4 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.js +18 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.js +13 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.js +40 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.d.ts +19 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.js +60 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.d.ts +10 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.js +53 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.js +38 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.d.ts +9 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.js +66 -0
- package/data/packages/spec/dist/src/typeUtils.d.ts +3 -0
- package/data/packages/spec/dist/src/typeUtils.d.ts.map +1 -0
- package/data/packages/spec/dist/src/typeUtils.js +1 -0
- package/data/packages/{wasp-config → spec}/package-lock.json +921 -1475
- package/data/packages/spec/package.json +48 -0
- package/data/packages/studio/package-lock.json +2 -2
- package/data/packages/studio/package.json +1 -1
- package/data/packages/ts-inspect/package-lock.json +2 -2
- package/data/packages/ts-inspect/package.json +1 -1
- package/package.json +1 -1
- package/wasp-bin +0 -0
- package/data/Cli/starters/basic/.prettierrc +0 -3
- package/data/Cli/starters/basic/main.wasp +0 -100
- package/data/Cli/starters/minimal/main.wasp +0 -14
- package/data/Cli/starters/ts-minimal/main.wasp.ts +0 -15
- package/data/Cli/starters/ts-minimal/package.json +0 -18
- package/data/Cli/starters/ts-minimal/schema.prisma +0 -10
- package/data/Cli/starters/ts-minimal/src/Main.css +0 -103
- package/data/Cli/starters/ts-minimal/src/MainPage.tsx +0 -37
- package/data/Cli/starters/ts-minimal/src/assets/logo.svg +0 -1
- package/data/Cli/starters/ts-minimal/tsconfig.json +0 -7
- package/data/Cli/starters/ts-minimal/vite.config.ts +0 -9
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +0 -65
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/_private.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/cli.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/cli.js +0 -24
- package/data/packages/wasp-config/dist/src/index.d.ts +0 -8
- package/data/packages/wasp-config/dist/src/index.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/index.js +0 -1
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/run.js +0 -18
- package/data/packages/wasp-config/package.json +0 -40
- /package/data/packages/{wasp-config → spec}/dist/__tests__/cli.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/__tests__/cli.unit.test.d.ts.map +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/appAnalyzer.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.test-d.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.test-d.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/appSpec.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.d.ts.map +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/_private.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/_private.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/appAnalyzer.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/App.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/App.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/tsAppSpec.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/run.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/run.d.ts.map +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import * as cp from "node:child_process";
|
|
54
|
+
import * as fs from "node:fs";
|
|
55
|
+
import * as os from "node:os";
|
|
56
|
+
import * as path from "node:path";
|
|
57
|
+
import { describe, expect, test } from "vitest";
|
|
58
|
+
const SPEC_PACKAGE_DIR = path.resolve(import.meta.dirname, "..", "..");
|
|
59
|
+
describe("Wasp TS spec pipeline", () => {
|
|
60
|
+
test("analyzes split specs with lowered ref imports", () => {
|
|
61
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
62
|
+
try {
|
|
63
|
+
const project = __addDisposableResource(env_1, makeTempProject("wasp-spec-pipeline-"), false);
|
|
64
|
+
project.writeProjectFile("src/MainPage.ts", `export default function MainPage() { return null; }\n`);
|
|
65
|
+
project.writeProjectFile("src/adminOperations.ts", [
|
|
66
|
+
`throw new Error("ref import was executed");`,
|
|
67
|
+
`export async function archive() { return null; }`,
|
|
68
|
+
``,
|
|
69
|
+
].join("\n"));
|
|
70
|
+
project.writeProjectFile("src/features/home.wasp.ts", [
|
|
71
|
+
`import { page } from "@wasp.sh/spec";`,
|
|
72
|
+
`import MainPage from "../MainPage" with { type: "ref" };`,
|
|
73
|
+
``,
|
|
74
|
+
`export const homePage = page(MainPage);`,
|
|
75
|
+
].join("\n"));
|
|
76
|
+
project.writeProjectFile("src/features/tasks.wasp.ts", [
|
|
77
|
+
`import { action } from "@wasp.sh/spec";`,
|
|
78
|
+
`import { archive } from "../adminOperations" with { type: "ref" };`,
|
|
79
|
+
``,
|
|
80
|
+
`export const splitTitle = "Split Demo";`,
|
|
81
|
+
`export const archiveAction = action(archive, { entities: [] });`,
|
|
82
|
+
].join("\n"));
|
|
83
|
+
project.writeProjectFile("src/features/faq.wasp.ts", [
|
|
84
|
+
`import { page } from "@wasp.sh/spec";`,
|
|
85
|
+
`import { splitTitle } from "./tasks.wasp";`,
|
|
86
|
+
`import FaqPage from "./faq/FaqPage" with { type: "ref" };`,
|
|
87
|
+
``,
|
|
88
|
+
`export const faqPage = page(FaqPage);`,
|
|
89
|
+
].join("\n"));
|
|
90
|
+
project.writeProjectFile("src/features/faq/FaqPage.ts", [`export defautl function FaqPage() { return null; }`].join("\n"));
|
|
91
|
+
const result = project.analyzeSpec([
|
|
92
|
+
`import { app } from "@wasp.sh/spec";`,
|
|
93
|
+
`import { homePage } from "./src/features/home.wasp";`,
|
|
94
|
+
`import { archiveAction, splitTitle } from "./src/features/tasks.wasp";`,
|
|
95
|
+
`import { faqPage } from "./src/features/faq.wasp";`,
|
|
96
|
+
``,
|
|
97
|
+
`export default app({`,
|
|
98
|
+
` name: "demo",`,
|
|
99
|
+
` title: splitTitle,`,
|
|
100
|
+
` wasp: { version: "^0.16.0" },`,
|
|
101
|
+
` spec: [homePage, archiveAction, faqPage],`,
|
|
102
|
+
`});`,
|
|
103
|
+
].join("\n"));
|
|
104
|
+
expect(result).toMatchSnapshot();
|
|
105
|
+
}
|
|
106
|
+
catch (e_1) {
|
|
107
|
+
env_1.error = e_1;
|
|
108
|
+
env_1.hasError = true;
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
__disposeResources(env_1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
test("surfaces type errors in the spec as a SpecUserError with formatted diagnostics", () => {
|
|
115
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
116
|
+
try {
|
|
117
|
+
const project = __addDisposableResource(env_2, makeTempProject("wasp-spec-pipeline-type-error-"), false);
|
|
118
|
+
const result = project.analyzeSpec([
|
|
119
|
+
`import { app } from "@wasp.sh/spec";`,
|
|
120
|
+
``,
|
|
121
|
+
`export const oops: string = 123;`,
|
|
122
|
+
``,
|
|
123
|
+
`export default app({`,
|
|
124
|
+
` name: "demo",`,
|
|
125
|
+
` title: "Demo",`,
|
|
126
|
+
` wasp: { version: "^0.16.0" },`,
|
|
127
|
+
` spec: [],`,
|
|
128
|
+
`});`,
|
|
129
|
+
].join("\n"));
|
|
130
|
+
expect(result).toEqual({
|
|
131
|
+
status: "error",
|
|
132
|
+
error: expect.stringContaining("Type 'number' is not assignable to type 'string'"),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (e_2) {
|
|
136
|
+
env_2.error = e_2;
|
|
137
|
+
env_2.hasError = true;
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
__disposeResources(env_2);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
test("rejects namespace ref imports with a SpecUserError", () => {
|
|
144
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
145
|
+
try {
|
|
146
|
+
const project = __addDisposableResource(env_3, makeTempProject("wasp-spec-pipeline-namespace-"), false);
|
|
147
|
+
project.writeProjectFile("src/operations.ts", `export async function archive() { return null; }\n`);
|
|
148
|
+
const result = project.analyzeSpec([
|
|
149
|
+
`import { app } from "@wasp.sh/spec";`,
|
|
150
|
+
`import * as ops from "./src/operations" with { type: "ref" };`,
|
|
151
|
+
``,
|
|
152
|
+
`export default app({`,
|
|
153
|
+
` name: "demo",`,
|
|
154
|
+
` title: "Demo",`,
|
|
155
|
+
` wasp: { version: "^0.16.0" },`,
|
|
156
|
+
` spec: [],`,
|
|
157
|
+
`});`,
|
|
158
|
+
].join("\n"));
|
|
159
|
+
expect(result).toEqual({
|
|
160
|
+
status: "error",
|
|
161
|
+
error: expect.stringContaining("Namespace imports are not supported for reference imports"),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch (e_3) {
|
|
165
|
+
env_3.error = e_3;
|
|
166
|
+
env_3.hasError = true;
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
__disposeResources(env_3);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
function makeTempProject(prefix) {
|
|
174
|
+
const projectRootDir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
175
|
+
return scaffoldProject({
|
|
176
|
+
projectRootDir,
|
|
177
|
+
dispose: () => fs.rmSync(projectRootDir, { recursive: true, force: true }),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function scaffoldProject({ projectRootDir, dispose, }) {
|
|
181
|
+
const tsconfigPath = path.join(projectRootDir, "tsconfig.json");
|
|
182
|
+
fs.writeFileSync(path.join(projectRootDir, "package.json"), JSON.stringify({
|
|
183
|
+
type: "module",
|
|
184
|
+
dependencies: { "@wasp.sh/spec": "file:" + SPEC_PACKAGE_DIR },
|
|
185
|
+
}));
|
|
186
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify({
|
|
187
|
+
compilerOptions: {
|
|
188
|
+
target: "ES2022",
|
|
189
|
+
module: "ESNext",
|
|
190
|
+
moduleResolution: "bundler",
|
|
191
|
+
jsx: "preserve",
|
|
192
|
+
strict: true,
|
|
193
|
+
allowJs: true,
|
|
194
|
+
noEmit: true,
|
|
195
|
+
},
|
|
196
|
+
include: ["main.wasp.ts", "**/*.wasp.ts"],
|
|
197
|
+
}));
|
|
198
|
+
return {
|
|
199
|
+
[Symbol.dispose]: dispose,
|
|
200
|
+
writeProjectFile: (relativeFilePath, sourceText) => {
|
|
201
|
+
writeProjectFile(projectRootDir, relativeFilePath, sourceText);
|
|
202
|
+
},
|
|
203
|
+
analyzeSpec: (sourceText) => {
|
|
204
|
+
writeProjectFile(projectRootDir, "main.wasp.ts", sourceText);
|
|
205
|
+
cp.execSync("npm i", { cwd: projectRootDir, stdio: "inherit" });
|
|
206
|
+
cp.execSync("npx @wasp.sh/spec analyze main.wasp.ts tsconfig.json . result.json '[]'", { cwd: projectRootDir, stdio: "inherit" });
|
|
207
|
+
return JSON.parse(fs.readFileSync(path.join(projectRootDir, "result.json"), "utf8"));
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function writeProjectFile(projectRootDir, relativeFilePath, sourceText) {
|
|
212
|
+
const filePath = path.join(projectRootDir, relativeFilePath);
|
|
213
|
+
writeFile(filePath, sourceText);
|
|
214
|
+
}
|
|
215
|
+
function writeFile(filePath, sourceText) {
|
|
216
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
217
|
+
fs.writeFileSync(filePath, sourceText, "utf8");
|
|
218
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.unit.test.d.ts","sourceRoot":"","sources":["../../../../__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.ts"],"names":[],"mappings":""}
|
package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { RolldownMagicString } from "rolldown";
|
|
2
|
+
import { parseAst } from "rolldown/parseAst";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
import { transformRefImports_mutate } from "../../../src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.js";
|
|
5
|
+
import { SpecUserError } from "../../../src/spec/specUserError.js";
|
|
6
|
+
describe("transformRefImports", () => {
|
|
7
|
+
test("leaves files without ref imports untouched", () => {
|
|
8
|
+
expect(transformImports([`const title = "Demo";`, ``].join("\n"))).toBe([`const title = "Demo";`, ``].join("\n"));
|
|
9
|
+
});
|
|
10
|
+
test.for([
|
|
11
|
+
{
|
|
12
|
+
caseName: "a default ref import",
|
|
13
|
+
sourceLines: [
|
|
14
|
+
`import MainPage from "../MainPage" with { type: "ref" };`,
|
|
15
|
+
``,
|
|
16
|
+
],
|
|
17
|
+
expectedLines: [
|
|
18
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
19
|
+
`const MainPage = ref({"importDefault":"MainPage","from":"../MainPage"});`,
|
|
20
|
+
``,
|
|
21
|
+
``,
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
caseName: "named ref imports",
|
|
26
|
+
sourceLines: [
|
|
27
|
+
`import { getTasks, createTask } from "./operations" with { type: "ref" };`,
|
|
28
|
+
``,
|
|
29
|
+
],
|
|
30
|
+
expectedLines: [
|
|
31
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
32
|
+
`const getTasks = ref({"import":"getTasks","alias":"getTasks","from":"./operations"});`,
|
|
33
|
+
`const createTask = ref({"import":"createTask","alias":"createTask","from":"./operations"});`,
|
|
34
|
+
``,
|
|
35
|
+
``,
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
caseName: "aliased named ref imports",
|
|
40
|
+
sourceLines: [
|
|
41
|
+
`import { archive as archiveTask } from "./operations" with { type: "ref" };`,
|
|
42
|
+
``,
|
|
43
|
+
],
|
|
44
|
+
expectedLines: [
|
|
45
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
46
|
+
`const archiveTask = ref({"import":"archive","alias":"archiveTask","from":"./operations"});`,
|
|
47
|
+
``,
|
|
48
|
+
``,
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
caseName: "a combined default and named ref import",
|
|
53
|
+
sourceLines: [
|
|
54
|
+
`import MainPage, { Helper } from "./src/MainPage" with { type: "ref" };`,
|
|
55
|
+
``,
|
|
56
|
+
],
|
|
57
|
+
expectedLines: [
|
|
58
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
59
|
+
`const MainPage = ref({"importDefault":"MainPage","from":"./src/MainPage"});`,
|
|
60
|
+
`const Helper = ref({"import":"Helper","alias":"Helper","from":"./src/MainPage"});`,
|
|
61
|
+
``,
|
|
62
|
+
``,
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
])("transforms $caseName", ({ sourceLines, expectedLines }) => {
|
|
66
|
+
expect(transformImports(sourceLines.join("\n"))).toBe(expectedLines.join("\n"));
|
|
67
|
+
});
|
|
68
|
+
test("rejects namespace ref imports with a SpecUserError", () => {
|
|
69
|
+
expect(() => transformImports([
|
|
70
|
+
`import * as adminOperations from "../adminOperations" with { type: "ref" };`,
|
|
71
|
+
``,
|
|
72
|
+
].join("\n"))).toThrow(SpecUserError);
|
|
73
|
+
});
|
|
74
|
+
test("mentions the offending namespace binding in the error", () => {
|
|
75
|
+
expect(() => transformImports([
|
|
76
|
+
`import * as adminOperations from "../adminOperations" with { type: "ref" };`,
|
|
77
|
+
``,
|
|
78
|
+
].join("\n"))).toThrow(/import \* as adminOperations/);
|
|
79
|
+
});
|
|
80
|
+
test("transforms only ref imports in a mixed file", () => {
|
|
81
|
+
expect(transformImports([
|
|
82
|
+
`import { app } from "@wasp.sh/spec";`,
|
|
83
|
+
`import z from "zod";`,
|
|
84
|
+
`import helper from "./helpers";`,
|
|
85
|
+
`import MainPage from "./src/MainPage" with { type: "ref" };`,
|
|
86
|
+
`export { helper } from "./helpers";`,
|
|
87
|
+
`const title = "Demo";`,
|
|
88
|
+
``,
|
|
89
|
+
].join("\n"))).toBe([
|
|
90
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
91
|
+
`const MainPage = ref({"importDefault":"MainPage","from":"./src/MainPage"});`,
|
|
92
|
+
`import { app } from "@wasp.sh/spec";`,
|
|
93
|
+
`import z from "zod";`,
|
|
94
|
+
`import helper from "./helpers";`,
|
|
95
|
+
``,
|
|
96
|
+
`export { helper } from "./helpers";`,
|
|
97
|
+
`const title = "Demo";`,
|
|
98
|
+
``,
|
|
99
|
+
].join("\n"));
|
|
100
|
+
});
|
|
101
|
+
test("generates a ref helper name that avoids top-level binding collisions", () => {
|
|
102
|
+
expect(transformImports([
|
|
103
|
+
`const ref = "taken";`,
|
|
104
|
+
`const ref1 = "taken";`,
|
|
105
|
+
`import MainPage from "./src/MainPage" with { type: "ref" };`,
|
|
106
|
+
``,
|
|
107
|
+
].join("\n"))).toBe([
|
|
108
|
+
`import { ref as ref_0 } from "@wasp.sh/spec";`,
|
|
109
|
+
`const MainPage = ref_0({"importDefault":"MainPage","from":"./src/MainPage"});`,
|
|
110
|
+
`const ref = "taken";`,
|
|
111
|
+
`const ref1 = "taken";`,
|
|
112
|
+
``,
|
|
113
|
+
``,
|
|
114
|
+
].join("\n"));
|
|
115
|
+
});
|
|
116
|
+
test("avoids collisions with destructured and declared top-level bindings", () => {
|
|
117
|
+
expect(transformImports([
|
|
118
|
+
`import { ref } from "./helpers";`,
|
|
119
|
+
`const { ref1, nested: { ref2 }, ...ref3 } = helpers;`,
|
|
120
|
+
`function ref4() {}`,
|
|
121
|
+
`import MainPage from "./src/MainPage" with { type: "ref" };`,
|
|
122
|
+
``,
|
|
123
|
+
].join("\n"))).toBe([
|
|
124
|
+
`import { ref as ref_0 } from "@wasp.sh/spec";`,
|
|
125
|
+
`const MainPage = ref_0({"importDefault":"MainPage","from":"./src/MainPage"});`,
|
|
126
|
+
`import { ref } from "./helpers";`,
|
|
127
|
+
`const { ref1, nested: { ref2 }, ...ref3 } = helpers;`,
|
|
128
|
+
`function ref4() {}`,
|
|
129
|
+
``,
|
|
130
|
+
``,
|
|
131
|
+
].join("\n"));
|
|
132
|
+
});
|
|
133
|
+
describe("ref imports without specifiers", () => {
|
|
134
|
+
test.for([
|
|
135
|
+
{
|
|
136
|
+
caseName: "a side-effect ref import",
|
|
137
|
+
source: `import "./operations" with { type: "ref" };`,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
caseName: "an empty named ref import",
|
|
141
|
+
source: `import {} from "./operations" with { type: "ref" };`,
|
|
142
|
+
},
|
|
143
|
+
])("rejects $caseName", ({ source }) => {
|
|
144
|
+
expect(() => transformImports(source)).toThrow(SpecUserError);
|
|
145
|
+
expect(() => transformImports(source)).toThrow("must import at least one binding");
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
test("leaves re-exports without the ref attribute untouched", () => {
|
|
149
|
+
const source = `export { helper } from "./helpers";\n`;
|
|
150
|
+
expect(transformImports(source)).toBe(source);
|
|
151
|
+
});
|
|
152
|
+
test("transforms a ref import that is then re-exported", () => {
|
|
153
|
+
expect(transformImports([
|
|
154
|
+
`import MainPage from "./src/MainPage" with { type: "ref" };`,
|
|
155
|
+
`export { MainPage };`,
|
|
156
|
+
``,
|
|
157
|
+
].join("\n"))).toBe([
|
|
158
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
159
|
+
`const MainPage = ref({"importDefault":"MainPage","from":"./src/MainPage"});`,
|
|
160
|
+
``,
|
|
161
|
+
`export { MainPage };`,
|
|
162
|
+
``,
|
|
163
|
+
].join("\n"));
|
|
164
|
+
});
|
|
165
|
+
test("throws when transforming re-exports with ref imports", () => {
|
|
166
|
+
expect(() => transformImports(`export { MainPage } from "./src/MainPage" with { type: "ref" };`)).toThrow(SpecUserError);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
function transformImports(sourceText) {
|
|
170
|
+
const ast = parseAst(sourceText, { lang: "ts" });
|
|
171
|
+
const source = new RolldownMagicString(sourceText);
|
|
172
|
+
transformRefImports_mutate(ast, source);
|
|
173
|
+
return source.toString();
|
|
174
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refHelper.unit.test.d.ts","sourceRoot":"","sources":["../../../../__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { RolldownMagicString } from "rolldown";
|
|
2
|
+
import { parseAst } from "rolldown/parseAst";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
import { transformRefHelper_mutate } from "../../../src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.js";
|
|
5
|
+
import { SpecUserError } from "../../../src/spec/specUserError.js";
|
|
6
|
+
describe("transformRefHelper", () => {
|
|
7
|
+
test("leaves files without a public ref import untouched", () => {
|
|
8
|
+
expect(transformRefHelper([`const title = "Demo";`, ``].join("\n"))).toBe([`const title = "Demo";`, ``].join("\n"));
|
|
9
|
+
});
|
|
10
|
+
test("rewrites a public ref import into the internal helper", () => {
|
|
11
|
+
expect(transformRefHelper([
|
|
12
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
13
|
+
`const MainPage = ref({ importDefault: "MainPage", from: "./src/MainPage" });`,
|
|
14
|
+
``,
|
|
15
|
+
].join("\n"))).toBe([
|
|
16
|
+
`import { _waspMakeRef } from "@wasp.sh/spec/internal";`,
|
|
17
|
+
`const ref = _waspMakeRef("/path/main.wasp.ts");`,
|
|
18
|
+
``,
|
|
19
|
+
`const MainPage = ref({ importDefault: "MainPage", from: "./src/MainPage" });`,
|
|
20
|
+
``,
|
|
21
|
+
].join("\n"));
|
|
22
|
+
});
|
|
23
|
+
test("preserves the alias of an aliased public ref import", () => {
|
|
24
|
+
expect(transformRefHelper([
|
|
25
|
+
`import { ref as appRef } from "@wasp.sh/spec";`,
|
|
26
|
+
`const MainPage = appRef({ importDefault: "MainPage", from: "./src/MainPage" });`,
|
|
27
|
+
``,
|
|
28
|
+
].join("\n"))).toBe([
|
|
29
|
+
`import { _waspMakeRef } from "@wasp.sh/spec/internal";`,
|
|
30
|
+
`const appRef = _waspMakeRef("/path/main.wasp.ts");`,
|
|
31
|
+
``,
|
|
32
|
+
`const MainPage = appRef({ importDefault: "MainPage", from: "./src/MainPage" });`,
|
|
33
|
+
``,
|
|
34
|
+
].join("\n"));
|
|
35
|
+
});
|
|
36
|
+
test("generates helper names that avoid top-level binding collisions", () => {
|
|
37
|
+
expect(transformRefHelper([
|
|
38
|
+
`const ref = "taken";`,
|
|
39
|
+
`const _waspMakeRef = "taken";`,
|
|
40
|
+
`import { ref as appRef } from "@wasp.sh/spec";`,
|
|
41
|
+
``,
|
|
42
|
+
].join("\n"))).toBe([
|
|
43
|
+
`import { _waspMakeRef as _waspMakeRef_0 } from "@wasp.sh/spec/internal";`,
|
|
44
|
+
`const appRef = _waspMakeRef_0("/path/main.wasp.ts");`,
|
|
45
|
+
`const ref = "taken";`,
|
|
46
|
+
`const _waspMakeRef = "taken";`,
|
|
47
|
+
``,
|
|
48
|
+
``,
|
|
49
|
+
].join("\n"));
|
|
50
|
+
});
|
|
51
|
+
test("treats a class declaration as a top-level binding collision", () => {
|
|
52
|
+
expect(transformRefHelper([
|
|
53
|
+
`class _waspMakeRef {}`,
|
|
54
|
+
`import { ref as appRef } from "@wasp.sh/spec";`,
|
|
55
|
+
``,
|
|
56
|
+
].join("\n"))).toBe([
|
|
57
|
+
`import { _waspMakeRef as _waspMakeRef_0 } from "@wasp.sh/spec/internal";`,
|
|
58
|
+
`const appRef = _waspMakeRef_0("/path/main.wasp.ts");`,
|
|
59
|
+
`class _waspMakeRef {}`,
|
|
60
|
+
``,
|
|
61
|
+
``,
|
|
62
|
+
].join("\n"));
|
|
63
|
+
});
|
|
64
|
+
test("handles multiple ref imports in the same file", () => {
|
|
65
|
+
expect(transformRefHelper([
|
|
66
|
+
`import { ref as refA, ref as refB } from "@wasp.sh/spec";`,
|
|
67
|
+
`import { ref as refC } from "@wasp.sh/spec";`,
|
|
68
|
+
`import { ref } from "@wasp.sh/spec";`,
|
|
69
|
+
``,
|
|
70
|
+
].join("\n"))).toBe([
|
|
71
|
+
`import { _waspMakeRef } from "@wasp.sh/spec/internal";`,
|
|
72
|
+
`const refA = _waspMakeRef("/path/main.wasp.ts");`,
|
|
73
|
+
`const refB = refA;`,
|
|
74
|
+
`const refC = refA;`,
|
|
75
|
+
`const ref = refA;`,
|
|
76
|
+
``,
|
|
77
|
+
``,
|
|
78
|
+
``,
|
|
79
|
+
``,
|
|
80
|
+
// This is not a mistake: each newline is a removed import statement.
|
|
81
|
+
// The ranges in the AST don't cover the final newline of each.
|
|
82
|
+
].join("\n"));
|
|
83
|
+
});
|
|
84
|
+
test("preserves remaining @wasp.sh/spec specifiers when rewriting the ref import", () => {
|
|
85
|
+
expect(transformRefHelper([
|
|
86
|
+
`import { type RefObject, ref as appRef, page } from "@wasp.sh/spec";`,
|
|
87
|
+
`const MainPage = appRef({ importDefault: "MainPage", from: "./src/MainPage" });`,
|
|
88
|
+
``,
|
|
89
|
+
].join("\n"))).toBe([
|
|
90
|
+
`import { _waspMakeRef } from "@wasp.sh/spec/internal";`,
|
|
91
|
+
`const appRef = _waspMakeRef("/path/main.wasp.ts");`,
|
|
92
|
+
`import { type RefObject, page } from "@wasp.sh/spec";`,
|
|
93
|
+
`const MainPage = appRef({ importDefault: "MainPage", from: "./src/MainPage" });`,
|
|
94
|
+
``,
|
|
95
|
+
].join("\n"));
|
|
96
|
+
});
|
|
97
|
+
test("leaves re-exports from other modules untouched", () => {
|
|
98
|
+
const source = `export { ref } from "./helpers";\n`;
|
|
99
|
+
expect(transformRefHelper(source)).toBe(source);
|
|
100
|
+
});
|
|
101
|
+
test("rewrites a ref import that is then re-exported", () => {
|
|
102
|
+
expect(transformRefHelper([`import { ref } from "@wasp.sh/spec";`, `export { ref };`, ``].join("\n"))).toBe([
|
|
103
|
+
`import { _waspMakeRef } from "@wasp.sh/spec/internal";`,
|
|
104
|
+
`const ref = _waspMakeRef("/path/main.wasp.ts");`,
|
|
105
|
+
``,
|
|
106
|
+
`export { ref };`,
|
|
107
|
+
``,
|
|
108
|
+
].join("\n"));
|
|
109
|
+
});
|
|
110
|
+
test("throws when transforming re-exports of the ref helper", () => {
|
|
111
|
+
expect(() => transformRefHelper(`export { ref } from "@wasp.sh/spec";`)).toThrow(SpecUserError);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
function transformRefHelper(sourceText) {
|
|
115
|
+
const ast = parseAst(sourceText, { lang: "ts" });
|
|
116
|
+
const source = new RolldownMagicString(sourceText);
|
|
117
|
+
transformRefHelper_mutate("/path/main.wasp.ts", ast, source);
|
|
118
|
+
return source.toString();
|
|
119
|
+
}
|
|
@@ -86,9 +86,16 @@ export type App = {
|
|
|
86
86
|
emailSender: Optional<EmailSender>;
|
|
87
87
|
webSocket: Optional<WebSocket>;
|
|
88
88
|
};
|
|
89
|
-
export type
|
|
90
|
-
export type
|
|
91
|
-
|
|
89
|
+
export type ExtImport = NamedExtImport | DefaultExtImport;
|
|
90
|
+
export type ExtImportKind = ExtImport["kind"];
|
|
91
|
+
export type NamedExtImport = {
|
|
92
|
+
kind: "named";
|
|
93
|
+
name: string;
|
|
94
|
+
path: `@src/${string}`;
|
|
95
|
+
alias?: string;
|
|
96
|
+
};
|
|
97
|
+
export type DefaultExtImport = {
|
|
98
|
+
kind: "default";
|
|
92
99
|
name: string;
|
|
93
100
|
path: `@src/${string}`;
|
|
94
101
|
};
|
|
@@ -114,7 +121,6 @@ export type Wasp = {
|
|
|
114
121
|
};
|
|
115
122
|
export type Auth = {
|
|
116
123
|
userEntity: Ref<"Entity">;
|
|
117
|
-
externalAuthEntity: Optional<Ref<"Entity">>;
|
|
118
124
|
methods: AuthMethods;
|
|
119
125
|
onAuthFailedRedirectTo: string;
|
|
120
126
|
onAuthSucceededRedirectTo: Optional<string>;
|
|
@@ -127,6 +133,7 @@ export type Auth = {
|
|
|
127
133
|
};
|
|
128
134
|
export type AuthMethods = {
|
|
129
135
|
usernameAndPassword: Optional<UsernameAndPasswordConfig>;
|
|
136
|
+
slack: Optional<ExternalAuthConfig>;
|
|
130
137
|
discord: Optional<ExternalAuthConfig>;
|
|
131
138
|
google: Optional<ExternalAuthConfig>;
|
|
132
139
|
gitHub: Optional<ExternalAuthConfig>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appSpec.d.ts","sourceRoot":"","sources":["../../src/appSpec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,IAAI,GAAG;KAChB,IAAI,IAAI,MAAM,eAAe,GAAG;QAC/B,QAAQ,EAAE,IAAI,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;KAClC;CACF,CAAC,MAAM,eAAe,CAAC,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAA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AQ,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;IAChC,mBAAmB,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,EAAE,GAAG;IACf,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAC7B,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,SAAS,CAAC;IACd,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAsCA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function parseProcessArgsOrThrow(args) {
|
|
2
|
+
if (args.length !== 8 || args[2] !== "analyze") {
|
|
3
|
+
throw new Error("Usage: node run.js analyze <path to main.wasp.ts> <path to tsconfig.wasp.json> <project root dir> <path to spec result JSON file> <entity names json>");
|
|
4
|
+
}
|
|
5
|
+
const [_node, _runjs, _command, waspTsSpecPath, tsconfigPath, projectRootDir, specResultPath, entityNamesJson,] = args;
|
|
6
|
+
if (typeof waspTsSpecPath !== "string" ||
|
|
7
|
+
typeof tsconfigPath !== "string" ||
|
|
8
|
+
typeof projectRootDir !== "string" ||
|
|
9
|
+
typeof specResultPath !== "string" ||
|
|
10
|
+
typeof entityNamesJson !== "string") {
|
|
11
|
+
throw new Error("All arguments must be strings: <path to main.wasp.ts> <path to tsconfig.wasp.json> <project root dir> <path to spec result JSON file> <entity names json>");
|
|
12
|
+
}
|
|
13
|
+
const entityNames = getValidEntityNamesOrThrow(entityNamesJson);
|
|
14
|
+
return {
|
|
15
|
+
waspTsSpecPath,
|
|
16
|
+
tsconfigPath,
|
|
17
|
+
projectRootDir,
|
|
18
|
+
specResultPath,
|
|
19
|
+
entityNames,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function getValidEntityNamesOrThrow(entityNamesJson) {
|
|
23
|
+
const entities = JSON.parse(entityNamesJson);
|
|
24
|
+
if (!Array.isArray(entities)) {
|
|
25
|
+
throw new Error("The entity names JSON must be an array of entity names.");
|
|
26
|
+
}
|
|
27
|
+
return entities;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./spec/publicApi/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { _waspMakeRef } from "./spec/refObject.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_private.d.ts","sourceRoot":"","sources":["../../../src/legacy/_private.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,eAA4B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as AppSpec from "
|
|
1
|
+
import * as AppSpec from "../appSpec.js";
|
|
2
2
|
export declare function analyzeApp(waspTsSpecPath: string, entityNames: string[]): Promise<Result<AppSpec.Decl[], string>>;
|
|
3
3
|
/**
|
|
4
4
|
* Result type is used instead of exceptions for the normal control flow because:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/legacy/appAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAKzC,wBAAsB,UAAU,CAC9B,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,CAezC;AA0BD;;;;GAIG;AACH,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,IACpB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC"}
|