@wix/astro 1.0.25 → 1.0.26
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/build/index.js +82 -90
- package/build/index.js.map +1 -1
- package/build-browser-runtime/setup.js +24 -3393
- package/build-runtime/middleware/html-embeds.js +532 -10
- package/package.json +3 -2
- package/src/client-context/utils.ts +31 -14
- package/src/index.ts +8 -5
- package/src/middleware/html-embeds.ts +9 -17
- package/src/utils/buildBackofficeComponent.ts +1 -3
- package/src/utils/buildComponents.ts +0 -12
- package/src/utils/buildServicePluginComponent.ts +1 -3
- package/src/utils/buildWebhookComponent.ts +1 -3
- package/src/utils/createProjectModel.ts +11 -7
- package/src/utils/loadEnvVars.ts +8 -2
- package/tsconfig.json +1 -1
package/build/index.js
CHANGED
|
@@ -6012,18 +6012,18 @@ var require_chokidar = __commonJS({
|
|
|
6012
6012
|
return str;
|
|
6013
6013
|
};
|
|
6014
6014
|
var normalizePathToUnix = (path4) => toUnix(sysPath.normalize(toUnix(path4)));
|
|
6015
|
-
var normalizeIgnored = (
|
|
6015
|
+
var normalizeIgnored = (cwd = EMPTY_STR) => (path4) => {
|
|
6016
6016
|
if (typeof path4 !== STRING_TYPE) return path4;
|
|
6017
|
-
return normalizePathToUnix(sysPath.isAbsolute(path4) ? path4 : sysPath.join(
|
|
6017
|
+
return normalizePathToUnix(sysPath.isAbsolute(path4) ? path4 : sysPath.join(cwd, path4));
|
|
6018
6018
|
};
|
|
6019
|
-
var getAbsolutePath = (path4,
|
|
6019
|
+
var getAbsolutePath = (path4, cwd) => {
|
|
6020
6020
|
if (sysPath.isAbsolute(path4)) {
|
|
6021
6021
|
return path4;
|
|
6022
6022
|
}
|
|
6023
6023
|
if (path4.startsWith(BANG)) {
|
|
6024
|
-
return BANG + sysPath.join(
|
|
6024
|
+
return BANG + sysPath.join(cwd, path4.slice(1));
|
|
6025
6025
|
}
|
|
6026
|
-
return sysPath.join(
|
|
6026
|
+
return sysPath.join(cwd, path4);
|
|
6027
6027
|
};
|
|
6028
6028
|
var undef = (opts, key) => opts[key] === void 0;
|
|
6029
6029
|
var DirEntry = class {
|
|
@@ -6224,12 +6224,12 @@ var require_chokidar = __commonJS({
|
|
|
6224
6224
|
* @returns {FSWatcher} for chaining
|
|
6225
6225
|
*/
|
|
6226
6226
|
add(paths_, _origAdd, _internal) {
|
|
6227
|
-
const { cwd
|
|
6227
|
+
const { cwd, disableGlobbing } = this.options;
|
|
6228
6228
|
this.closed = false;
|
|
6229
6229
|
let paths = unifyPaths(paths_);
|
|
6230
|
-
if (
|
|
6230
|
+
if (cwd) {
|
|
6231
6231
|
paths = paths.map((path4) => {
|
|
6232
|
-
const absPath = getAbsolutePath(path4,
|
|
6232
|
+
const absPath = getAbsolutePath(path4, cwd);
|
|
6233
6233
|
if (disableGlobbing || !isGlob(path4)) {
|
|
6234
6234
|
return absPath;
|
|
6235
6235
|
}
|
|
@@ -6276,10 +6276,10 @@ var require_chokidar = __commonJS({
|
|
|
6276
6276
|
unwatch(paths_) {
|
|
6277
6277
|
if (this.closed) return this;
|
|
6278
6278
|
const paths = unifyPaths(paths_);
|
|
6279
|
-
const { cwd
|
|
6279
|
+
const { cwd } = this.options;
|
|
6280
6280
|
paths.forEach((path4) => {
|
|
6281
6281
|
if (!sysPath.isAbsolute(path4) && !this._closers.has(path4)) {
|
|
6282
|
-
if (
|
|
6282
|
+
if (cwd) path4 = sysPath.join(cwd, path4);
|
|
6283
6283
|
path4 = sysPath.resolve(path4);
|
|
6284
6284
|
}
|
|
6285
6285
|
this._closePath(path4);
|
|
@@ -6522,11 +6522,11 @@ var require_chokidar = __commonJS({
|
|
|
6522
6522
|
_isIgnored(path4, stats) {
|
|
6523
6523
|
if (this.options.atomic && DOT_RE.test(path4)) return true;
|
|
6524
6524
|
if (!this._userIgnored) {
|
|
6525
|
-
const { cwd
|
|
6525
|
+
const { cwd } = this.options;
|
|
6526
6526
|
const ign = this.options.ignored;
|
|
6527
|
-
const ignored = ign && ign.map(normalizeIgnored(
|
|
6527
|
+
const ignored = ign && ign.map(normalizeIgnored(cwd));
|
|
6528
6528
|
const paths = arrify(ignored).filter((path5) => typeof path5 === STRING_TYPE && !isGlob(path5)).map((path5) => path5 + SLASH_GLOBSTAR);
|
|
6529
|
-
const list = this._getGlobIgnored().map(normalizeIgnored(
|
|
6529
|
+
const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
|
|
6530
6530
|
this._userIgnored = anymatch(list, void 0, ANYMATCH_OPTS);
|
|
6531
6531
|
}
|
|
6532
6532
|
return this._userIgnored([path4, stats]);
|
|
@@ -6759,8 +6759,8 @@ var require_path = __commonJS({
|
|
|
6759
6759
|
return filepath.replace(/\\/g, "/");
|
|
6760
6760
|
}
|
|
6761
6761
|
exports.unixify = unixify;
|
|
6762
|
-
function makeAbsolute(
|
|
6763
|
-
return path4.resolve(
|
|
6762
|
+
function makeAbsolute(cwd, filepath) {
|
|
6763
|
+
return path4.resolve(cwd, filepath);
|
|
6764
6764
|
}
|
|
6765
6765
|
exports.makeAbsolute = makeAbsolute;
|
|
6766
6766
|
function removeLeadingDotSegment(entry) {
|
|
@@ -11711,12 +11711,11 @@ async function buildBackofficeComponent({
|
|
|
11711
11711
|
codegenDir,
|
|
11712
11712
|
component,
|
|
11713
11713
|
entryFileName,
|
|
11714
|
-
injectRoute
|
|
11715
|
-
rootDir
|
|
11714
|
+
injectRoute
|
|
11716
11715
|
}) {
|
|
11717
11716
|
const directory = join3(codegenDir, component.manifest.compId);
|
|
11718
11717
|
await outputDir(directory);
|
|
11719
|
-
const entryFilePath = join3(
|
|
11718
|
+
const entryFilePath = join3(component.directory, entryFileName);
|
|
11720
11719
|
const entrypoint = join3(directory, `entry.astro`);
|
|
11721
11720
|
const HocEntrypoint = join3(directory, `wrapper.tsx`);
|
|
11722
11721
|
await writeFile2(
|
|
@@ -11758,13 +11757,12 @@ import { join as join4 } from "path";
|
|
|
11758
11757
|
async function buildServicePluginComponent({
|
|
11759
11758
|
codegenDir,
|
|
11760
11759
|
component,
|
|
11761
|
-
injectRoute
|
|
11762
|
-
rootDir
|
|
11760
|
+
injectRoute
|
|
11763
11761
|
}) {
|
|
11764
11762
|
const directory = join4(codegenDir, component.manifest.compId);
|
|
11765
11763
|
await outputDir(directory);
|
|
11766
11764
|
const entrypoint = join4(directory, `entry.ts`);
|
|
11767
|
-
const entryFilePath = join4(
|
|
11765
|
+
const entryFilePath = join4(component.directory, "plugin.ts");
|
|
11768
11766
|
await writeFile3(
|
|
11769
11767
|
entrypoint,
|
|
11770
11768
|
defaultOutdent`
|
|
@@ -11788,13 +11786,12 @@ import { join as join5 } from "path";
|
|
|
11788
11786
|
async function buildWebhookComponent({
|
|
11789
11787
|
codegenDir,
|
|
11790
11788
|
component,
|
|
11791
|
-
injectRoute
|
|
11792
|
-
rootDir
|
|
11789
|
+
injectRoute
|
|
11793
11790
|
}) {
|
|
11794
11791
|
const directory = join5(codegenDir, component.manifest.compId);
|
|
11795
11792
|
await outputDir(directory);
|
|
11796
11793
|
const entrypoint = join5(directory, `entry.ts`);
|
|
11797
|
-
const entryFilePath = join5(
|
|
11794
|
+
const entryFilePath = join5(component.directory, "event.ts");
|
|
11798
11795
|
await writeFile4(
|
|
11799
11796
|
entrypoint,
|
|
11800
11797
|
defaultOutdent`
|
|
@@ -11818,7 +11815,6 @@ async function buildComponents({
|
|
|
11818
11815
|
isDev,
|
|
11819
11816
|
model
|
|
11820
11817
|
}) {
|
|
11821
|
-
const { rootDir } = model;
|
|
11822
11818
|
const injectRoute = isDev ? () => null : originalInjectRoute;
|
|
11823
11819
|
const backofficeCodegenDir = join6(extensionsDir, "backoffice");
|
|
11824
11820
|
const webhooksCodegenDir = join6(extensionsDir, "webhooks");
|
|
@@ -11836,8 +11832,7 @@ async function buildComponents({
|
|
|
11836
11832
|
codegenDir: backofficeCodegenDir,
|
|
11837
11833
|
component,
|
|
11838
11834
|
entryFileName: "widget.tsx",
|
|
11839
|
-
injectRoute
|
|
11840
|
-
rootDir
|
|
11835
|
+
injectRoute
|
|
11841
11836
|
});
|
|
11842
11837
|
break;
|
|
11843
11838
|
}
|
|
@@ -11849,8 +11844,7 @@ async function buildComponents({
|
|
|
11849
11844
|
codegenDir: backofficeCodegenDir,
|
|
11850
11845
|
component,
|
|
11851
11846
|
entryFileName: "modal.tsx",
|
|
11852
|
-
injectRoute
|
|
11853
|
-
rootDir
|
|
11847
|
+
injectRoute
|
|
11854
11848
|
});
|
|
11855
11849
|
break;
|
|
11856
11850
|
}
|
|
@@ -11862,8 +11856,7 @@ async function buildComponents({
|
|
|
11862
11856
|
codegenDir: backofficeCodegenDir,
|
|
11863
11857
|
component,
|
|
11864
11858
|
entryFileName: "page.tsx",
|
|
11865
|
-
injectRoute
|
|
11866
|
-
rootDir
|
|
11859
|
+
injectRoute
|
|
11867
11860
|
});
|
|
11868
11861
|
break;
|
|
11869
11862
|
}
|
|
@@ -11874,8 +11867,7 @@ async function buildComponents({
|
|
|
11874
11867
|
await buildServicePluginComponent({
|
|
11875
11868
|
codegenDir: servicePluginsCodegenDir,
|
|
11876
11869
|
component,
|
|
11877
|
-
injectRoute
|
|
11878
|
-
rootDir
|
|
11870
|
+
injectRoute
|
|
11879
11871
|
});
|
|
11880
11872
|
break;
|
|
11881
11873
|
}
|
|
@@ -11886,8 +11878,7 @@ async function buildComponents({
|
|
|
11886
11878
|
await buildServicePluginComponent({
|
|
11887
11879
|
codegenDir: servicePluginsCodegenDir,
|
|
11888
11880
|
component,
|
|
11889
|
-
injectRoute
|
|
11890
|
-
rootDir
|
|
11881
|
+
injectRoute
|
|
11891
11882
|
});
|
|
11892
11883
|
break;
|
|
11893
11884
|
}
|
|
@@ -11898,8 +11889,7 @@ async function buildComponents({
|
|
|
11898
11889
|
await buildServicePluginComponent({
|
|
11899
11890
|
codegenDir: servicePluginsCodegenDir,
|
|
11900
11891
|
component,
|
|
11901
|
-
injectRoute
|
|
11902
|
-
rootDir
|
|
11892
|
+
injectRoute
|
|
11903
11893
|
});
|
|
11904
11894
|
break;
|
|
11905
11895
|
}
|
|
@@ -11910,8 +11900,7 @@ async function buildComponents({
|
|
|
11910
11900
|
await buildServicePluginComponent({
|
|
11911
11901
|
codegenDir: servicePluginsCodegenDir,
|
|
11912
11902
|
component,
|
|
11913
|
-
injectRoute
|
|
11914
|
-
rootDir
|
|
11903
|
+
injectRoute
|
|
11915
11904
|
});
|
|
11916
11905
|
break;
|
|
11917
11906
|
}
|
|
@@ -11922,8 +11911,7 @@ async function buildComponents({
|
|
|
11922
11911
|
await buildServicePluginComponent({
|
|
11923
11912
|
codegenDir: servicePluginsCodegenDir,
|
|
11924
11913
|
component,
|
|
11925
|
-
injectRoute
|
|
11926
|
-
rootDir
|
|
11914
|
+
injectRoute
|
|
11927
11915
|
});
|
|
11928
11916
|
break;
|
|
11929
11917
|
}
|
|
@@ -11934,8 +11922,7 @@ async function buildComponents({
|
|
|
11934
11922
|
await buildServicePluginComponent({
|
|
11935
11923
|
codegenDir: servicePluginsCodegenDir,
|
|
11936
11924
|
component,
|
|
11937
|
-
injectRoute
|
|
11938
|
-
rootDir
|
|
11925
|
+
injectRoute
|
|
11939
11926
|
});
|
|
11940
11927
|
break;
|
|
11941
11928
|
}
|
|
@@ -11946,8 +11933,7 @@ async function buildComponents({
|
|
|
11946
11933
|
await buildWebhookComponent({
|
|
11947
11934
|
codegenDir: webhooksCodegenDir,
|
|
11948
11935
|
component,
|
|
11949
|
-
injectRoute
|
|
11950
|
-
rootDir
|
|
11936
|
+
injectRoute
|
|
11951
11937
|
});
|
|
11952
11938
|
break;
|
|
11953
11939
|
}
|
|
@@ -11958,7 +11944,6 @@ async function buildComponents({
|
|
|
11958
11944
|
// src/utils/createProjectModel.ts
|
|
11959
11945
|
init_esm_shims();
|
|
11960
11946
|
import { join as join7 } from "path";
|
|
11961
|
-
import { cwd } from "process";
|
|
11962
11947
|
|
|
11963
11948
|
// ../../node_modules/globby/index.js
|
|
11964
11949
|
init_esm_shims();
|
|
@@ -12233,26 +12218,26 @@ var ignoreFilesGlobOptions = {
|
|
|
12233
12218
|
};
|
|
12234
12219
|
var GITIGNORE_FILES_PATTERN = "**/.gitignore";
|
|
12235
12220
|
var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path3.posix.join(base, pattern.slice(1)) : path3.posix.join(base, pattern);
|
|
12236
|
-
var parseIgnoreFile = (file,
|
|
12237
|
-
const base = slash(path3.relative(
|
|
12221
|
+
var parseIgnoreFile = (file, cwd) => {
|
|
12222
|
+
const base = slash(path3.relative(cwd, path3.dirname(file.filePath)));
|
|
12238
12223
|
return file.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
|
|
12239
12224
|
};
|
|
12240
|
-
var toRelativePath2 = (fileOrDirectory,
|
|
12241
|
-
|
|
12225
|
+
var toRelativePath2 = (fileOrDirectory, cwd) => {
|
|
12226
|
+
cwd = slash(cwd);
|
|
12242
12227
|
if (path3.isAbsolute(fileOrDirectory)) {
|
|
12243
|
-
if (slash(fileOrDirectory).startsWith(
|
|
12244
|
-
return path3.relative(
|
|
12228
|
+
if (slash(fileOrDirectory).startsWith(cwd)) {
|
|
12229
|
+
return path3.relative(cwd, fileOrDirectory);
|
|
12245
12230
|
}
|
|
12246
|
-
throw new Error(`Path ${fileOrDirectory} is not in cwd ${
|
|
12231
|
+
throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
|
|
12247
12232
|
}
|
|
12248
12233
|
return fileOrDirectory;
|
|
12249
12234
|
};
|
|
12250
|
-
var getIsIgnoredPredicate = (files,
|
|
12251
|
-
const patterns = files.flatMap((file) => parseIgnoreFile(file,
|
|
12235
|
+
var getIsIgnoredPredicate = (files, cwd) => {
|
|
12236
|
+
const patterns = files.flatMap((file) => parseIgnoreFile(file, cwd));
|
|
12252
12237
|
const ignores = (0, import_ignore.default)().add(patterns);
|
|
12253
12238
|
return (fileOrDirectory) => {
|
|
12254
12239
|
fileOrDirectory = toPath(fileOrDirectory);
|
|
12255
|
-
fileOrDirectory = toRelativePath2(fileOrDirectory,
|
|
12240
|
+
fileOrDirectory = toRelativePath2(fileOrDirectory, cwd);
|
|
12256
12241
|
return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
|
|
12257
12242
|
};
|
|
12258
12243
|
};
|
|
@@ -12263,9 +12248,9 @@ var normalizeOptions = (options = {}) => ({
|
|
|
12263
12248
|
ignore: [...options.ignore ?? [], ...defaultIgnoredDirectories]
|
|
12264
12249
|
});
|
|
12265
12250
|
var isIgnoredByIgnoreFiles = async (patterns, options) => {
|
|
12266
|
-
const { cwd
|
|
12251
|
+
const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
|
|
12267
12252
|
const paths = await (0, import_fast_glob.default)(patterns, {
|
|
12268
|
-
cwd
|
|
12253
|
+
cwd,
|
|
12269
12254
|
suppressErrors,
|
|
12270
12255
|
deep,
|
|
12271
12256
|
ignore,
|
|
@@ -12277,12 +12262,12 @@ var isIgnoredByIgnoreFiles = async (patterns, options) => {
|
|
|
12277
12262
|
content: await fsPromises2.readFile(filePath, "utf8")
|
|
12278
12263
|
}))
|
|
12279
12264
|
);
|
|
12280
|
-
return getIsIgnoredPredicate(files,
|
|
12265
|
+
return getIsIgnoredPredicate(files, cwd);
|
|
12281
12266
|
};
|
|
12282
12267
|
var isIgnoredByIgnoreFilesSync = (patterns, options) => {
|
|
12283
|
-
const { cwd
|
|
12268
|
+
const { cwd, suppressErrors, deep, ignore } = normalizeOptions(options);
|
|
12284
12269
|
const paths = import_fast_glob.default.sync(patterns, {
|
|
12285
|
-
cwd
|
|
12270
|
+
cwd,
|
|
12286
12271
|
suppressErrors,
|
|
12287
12272
|
deep,
|
|
12288
12273
|
ignore,
|
|
@@ -12292,7 +12277,7 @@ var isIgnoredByIgnoreFilesSync = (patterns, options) => {
|
|
|
12292
12277
|
filePath,
|
|
12293
12278
|
content: fs2.readFileSync(filePath, "utf8")
|
|
12294
12279
|
}));
|
|
12295
|
-
return getIsIgnoredPredicate(files,
|
|
12280
|
+
return getIsIgnoredPredicate(files, cwd);
|
|
12296
12281
|
};
|
|
12297
12282
|
|
|
12298
12283
|
// ../../node_modules/globby/index.js
|
|
@@ -12301,41 +12286,41 @@ var assertPatternsInput = (patterns) => {
|
|
|
12301
12286
|
throw new TypeError("Patterns must be a string or an array of strings");
|
|
12302
12287
|
}
|
|
12303
12288
|
};
|
|
12304
|
-
var normalizePathForDirectoryGlob = (filePath,
|
|
12289
|
+
var normalizePathForDirectoryGlob = (filePath, cwd) => {
|
|
12305
12290
|
const path4 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
|
|
12306
|
-
return nodePath.isAbsolute(path4) ? path4 : nodePath.join(
|
|
12291
|
+
return nodePath.isAbsolute(path4) ? path4 : nodePath.join(cwd, path4);
|
|
12307
12292
|
};
|
|
12308
12293
|
var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
|
|
12309
12294
|
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
|
|
12310
12295
|
return files ? files.map((file) => nodePath.posix.join(directoryPath, `**/${nodePath.extname(file) ? file : `${file}${extensionGlob}`}`)) : [nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
|
|
12311
12296
|
};
|
|
12312
12297
|
var directoryToGlob = async (directoryPaths, {
|
|
12313
|
-
cwd
|
|
12298
|
+
cwd = process3.cwd(),
|
|
12314
12299
|
files,
|
|
12315
12300
|
extensions
|
|
12316
12301
|
} = {}) => {
|
|
12317
12302
|
const globs = await Promise.all(
|
|
12318
|
-
directoryPaths.map(async (directoryPath) => await isDirectory(normalizePathForDirectoryGlob(directoryPath,
|
|
12303
|
+
directoryPaths.map(async (directoryPath) => await isDirectory(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath)
|
|
12319
12304
|
);
|
|
12320
12305
|
return globs.flat();
|
|
12321
12306
|
};
|
|
12322
12307
|
var directoryToGlobSync = (directoryPaths, {
|
|
12323
|
-
cwd
|
|
12308
|
+
cwd = process3.cwd(),
|
|
12324
12309
|
files,
|
|
12325
12310
|
extensions
|
|
12326
|
-
} = {}) => directoryPaths.flatMap((directoryPath) => isDirectorySync(normalizePathForDirectoryGlob(directoryPath,
|
|
12311
|
+
} = {}) => directoryPaths.flatMap((directoryPath) => isDirectorySync(normalizePathForDirectoryGlob(directoryPath, cwd)) ? getDirectoryGlob({ directoryPath, files, extensions }) : directoryPath);
|
|
12327
12312
|
var toPatternsArray = (patterns) => {
|
|
12328
12313
|
patterns = [...new Set([patterns].flat())];
|
|
12329
12314
|
assertPatternsInput(patterns);
|
|
12330
12315
|
return patterns;
|
|
12331
12316
|
};
|
|
12332
|
-
var checkCwdOption = (
|
|
12333
|
-
if (!
|
|
12317
|
+
var checkCwdOption = (cwd) => {
|
|
12318
|
+
if (!cwd) {
|
|
12334
12319
|
return;
|
|
12335
12320
|
}
|
|
12336
12321
|
let stat;
|
|
12337
12322
|
try {
|
|
12338
|
-
stat = fs3.statSync(
|
|
12323
|
+
stat = fs3.statSync(cwd);
|
|
12339
12324
|
} catch {
|
|
12340
12325
|
return;
|
|
12341
12326
|
}
|
|
@@ -12415,17 +12400,17 @@ var convertNegativePatterns = (patterns, options) => {
|
|
|
12415
12400
|
}
|
|
12416
12401
|
return tasks;
|
|
12417
12402
|
};
|
|
12418
|
-
var normalizeExpandDirectoriesOption = (options,
|
|
12419
|
-
...
|
|
12403
|
+
var normalizeExpandDirectoriesOption = (options, cwd) => ({
|
|
12404
|
+
...cwd ? { cwd } : {},
|
|
12420
12405
|
...Array.isArray(options) ? { files: options } : options
|
|
12421
12406
|
});
|
|
12422
12407
|
var generateTasks = async (patterns, options) => {
|
|
12423
12408
|
const globTasks = convertNegativePatterns(patterns, options);
|
|
12424
|
-
const { cwd
|
|
12409
|
+
const { cwd, expandDirectories } = options;
|
|
12425
12410
|
if (!expandDirectories) {
|
|
12426
12411
|
return globTasks;
|
|
12427
12412
|
}
|
|
12428
|
-
const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories,
|
|
12413
|
+
const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
|
|
12429
12414
|
return Promise.all(
|
|
12430
12415
|
globTasks.map(async (task) => {
|
|
12431
12416
|
let { patterns: patterns2, options: options2 } = task;
|
|
@@ -12434,7 +12419,7 @@ var generateTasks = async (patterns, options) => {
|
|
|
12434
12419
|
options2.ignore
|
|
12435
12420
|
] = await Promise.all([
|
|
12436
12421
|
directoryToGlob(patterns2, directoryToGlobOptions),
|
|
12437
|
-
directoryToGlob(options2.ignore, { cwd
|
|
12422
|
+
directoryToGlob(options2.ignore, { cwd })
|
|
12438
12423
|
]);
|
|
12439
12424
|
return { patterns: patterns2, options: options2 };
|
|
12440
12425
|
})
|
|
@@ -12442,15 +12427,15 @@ var generateTasks = async (patterns, options) => {
|
|
|
12442
12427
|
};
|
|
12443
12428
|
var generateTasksSync = (patterns, options) => {
|
|
12444
12429
|
const globTasks = convertNegativePatterns(patterns, options);
|
|
12445
|
-
const { cwd
|
|
12430
|
+
const { cwd, expandDirectories } = options;
|
|
12446
12431
|
if (!expandDirectories) {
|
|
12447
12432
|
return globTasks;
|
|
12448
12433
|
}
|
|
12449
|
-
const directoryToGlobSyncOptions = normalizeExpandDirectoriesOption(expandDirectories,
|
|
12434
|
+
const directoryToGlobSyncOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd);
|
|
12450
12435
|
return globTasks.map((task) => {
|
|
12451
12436
|
let { patterns: patterns2, options: options2 } = task;
|
|
12452
12437
|
patterns2 = directoryToGlobSync(patterns2, directoryToGlobSyncOptions);
|
|
12453
|
-
options2.ignore = directoryToGlobSync(options2.ignore, { cwd
|
|
12438
|
+
options2.ignore = directoryToGlobSync(options2.ignore, { cwd });
|
|
12454
12439
|
return { patterns: patterns2, options: options2 };
|
|
12455
12440
|
});
|
|
12456
12441
|
};
|
|
@@ -16508,8 +16493,11 @@ var source_default = chalk;
|
|
|
16508
16493
|
// src/utils/loadEnvVars.ts
|
|
16509
16494
|
import { loadEnv } from "vite";
|
|
16510
16495
|
var wixClientIdEnvVar = "WIX_CLIENT_ID";
|
|
16511
|
-
function loadEnvVars(
|
|
16512
|
-
|
|
16496
|
+
function loadEnvVars({
|
|
16497
|
+
logger,
|
|
16498
|
+
rootDir
|
|
16499
|
+
}) {
|
|
16500
|
+
const env2 = loadEnv("production", rootDir, "");
|
|
16513
16501
|
const appId = env2[wixClientIdEnvVar];
|
|
16514
16502
|
if (appId == null) {
|
|
16515
16503
|
logger.error(
|
|
@@ -16538,9 +16526,11 @@ function loadEnvVars(logger) {
|
|
|
16538
16526
|
}
|
|
16539
16527
|
|
|
16540
16528
|
// src/utils/createProjectModel.ts
|
|
16541
|
-
async function createProjectModel(
|
|
16542
|
-
|
|
16543
|
-
|
|
16529
|
+
async function createProjectModel({
|
|
16530
|
+
logger,
|
|
16531
|
+
rootDir
|
|
16532
|
+
}) {
|
|
16533
|
+
const { appId, env: env2 } = loadEnvVars({ logger, rootDir });
|
|
16544
16534
|
const componentsPaths = await globby(
|
|
16545
16535
|
pathToGlobby(join7(EXTENSIONS_DIR, "*")),
|
|
16546
16536
|
{
|
|
@@ -16550,7 +16540,8 @@ async function createProjectModel(logger) {
|
|
|
16550
16540
|
);
|
|
16551
16541
|
const components = [];
|
|
16552
16542
|
const unknownComponents = [];
|
|
16553
|
-
for (const
|
|
16543
|
+
for (const componentRelativePath of componentsPaths) {
|
|
16544
|
+
const componentPath = join7(rootDir, componentRelativePath);
|
|
16554
16545
|
const extensionManifest = await readExtensionManifest(componentPath);
|
|
16555
16546
|
const knownManifest = parseKnownExtensionManifest(extensionManifest);
|
|
16556
16547
|
if (knownManifest != null) {
|
|
@@ -16880,10 +16871,10 @@ var createIntegration = (options = {
|
|
|
16880
16871
|
return {
|
|
16881
16872
|
hooks: {
|
|
16882
16873
|
async "astro:build:done"({ logger }) {
|
|
16883
|
-
const
|
|
16874
|
+
const rootDir = fileURLToPath5(_config.root);
|
|
16875
|
+
const model = await createProjectModel({ logger, rootDir });
|
|
16884
16876
|
const appManifest = generateAppManifest(model);
|
|
16885
16877
|
const outDir = fileURLToPath5(_config.outDir);
|
|
16886
|
-
const rootDir = fileURLToPath5(_config.root);
|
|
16887
16878
|
const appManifestPath = join8(outDir, "_wix/app-manifest.json");
|
|
16888
16879
|
await writeJson(appManifestPath, appManifest, { spaces: 2 });
|
|
16889
16880
|
await writeJson(
|
|
@@ -16910,7 +16901,7 @@ var createIntegration = (options = {
|
|
|
16910
16901
|
const codegenDir = fileURLToPath5(codegenDirURL);
|
|
16911
16902
|
const rootDir = fileURLToPath5(config2.root);
|
|
16912
16903
|
const extensionsDir = join8(codegenDir, "extensions");
|
|
16913
|
-
const model = await createProjectModel(logger);
|
|
16904
|
+
const model = await createProjectModel({ logger, rootDir });
|
|
16914
16905
|
injectScript(
|
|
16915
16906
|
"before-hydration",
|
|
16916
16907
|
defaultOutdent`
|
|
@@ -17041,7 +17032,7 @@ var createIntegration = (options = {
|
|
|
17041
17032
|
ignoreInitial: true,
|
|
17042
17033
|
useFsEvents: false
|
|
17043
17034
|
}).on("all", async () => {
|
|
17044
|
-
const model2 = await createProjectModel(logger);
|
|
17035
|
+
const model2 = await createProjectModel({ logger, rootDir });
|
|
17045
17036
|
await removeUnusedCodegenFiles({ extensionsDir, model: model2 });
|
|
17046
17037
|
await buildComponents({
|
|
17047
17038
|
extensionsDir,
|
|
@@ -17053,9 +17044,10 @@ var createIntegration = (options = {
|
|
|
17053
17044
|
}
|
|
17054
17045
|
},
|
|
17055
17046
|
"astro:server:setup": ({ logger, server }) => {
|
|
17047
|
+
const rootDir = fileURLToPath5(_config.root);
|
|
17056
17048
|
server.middlewares.use(async (req, res, next) => {
|
|
17057
17049
|
if (req.url === "/_wix/app-manifest.json") {
|
|
17058
|
-
const model = await createProjectModel(logger);
|
|
17050
|
+
const model = await createProjectModel({ logger, rootDir });
|
|
17059
17051
|
const appManifest = generateAppManifest(model);
|
|
17060
17052
|
res.setHeader("Content-Type", "application/json");
|
|
17061
17053
|
res.end(JSON.stringify(appManifest));
|