edges-svelte 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/plugin/EdgesAutoHandlePlugin.js +5 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -60,8 +60,9 @@ export function createEdgesPluginFactory(packageName, serverPath) {
|
|
|
60
60
|
return `${beforeImports}\n${SYNC_MARKER}\n${importLine}\n${afterImports}`;
|
|
61
61
|
};
|
|
62
62
|
const ensureAstServerImport = (sourceCode) => ensureSyncImport(sourceCode, `import { __withEdgesServerLoad as ${AST_SERVER_LOAD_ALIAS}, __withEdgesActions as ${AST_ACTIONS_ALIAS} } from '${serverPath}';`);
|
|
63
|
-
const ensureAstUniversalImport = (sourceCode) => ensureSyncImport(sourceCode, `import { __withEdgesUniversalLoad as ${AST_UNIVERSAL_LOAD_ALIAS} } from '${
|
|
64
|
-
const
|
|
63
|
+
const ensureAstUniversalImport = (sourceCode) => ensureSyncImport(sourceCode, `import { __withEdgesUniversalLoad as ${AST_UNIVERSAL_LOAD_ALIAS} } from '${packageName}';`);
|
|
64
|
+
const ensureRegexServerImport = (sourceCode) => ensureSyncImport(sourceCode, `import { __withEdgesServerLoad, __withEdgesActions } from '${serverPath}';`);
|
|
65
|
+
const ensureRegexUniversalImport = (sourceCode) => ensureSyncImport(sourceCode, `import { __withEdgesUniversalLoad } from '${packageName}';`);
|
|
65
66
|
const findExportedLocal = (sourceFile, code, exportedName) => {
|
|
66
67
|
const edits = [];
|
|
67
68
|
let localName = null;
|
|
@@ -117,7 +118,7 @@ export function createEdgesPluginFactory(packageName, serverPath) {
|
|
|
117
118
|
if (!LOAD_EXPORT_PATTERN.test(sourceCode) && !ACTIONS_EXPORT_PATTERN.test(sourceCode)) {
|
|
118
119
|
return null;
|
|
119
120
|
}
|
|
120
|
-
let wrapped =
|
|
121
|
+
let wrapped = ensureRegexServerImport(sourceCode);
|
|
121
122
|
if (LOAD_EXPORT_PATTERN.test(wrapped)) {
|
|
122
123
|
wrapped = wrapped
|
|
123
124
|
.replace(LOAD_EXPORT_PATTERN, (match) => match.replace('export const load', 'const __userLoad'))
|
|
@@ -133,7 +134,7 @@ export function createEdgesPluginFactory(packageName, serverPath) {
|
|
|
133
134
|
const wrapUniversalRouteModuleRegex = (sourceCode) => {
|
|
134
135
|
if (!LOAD_EXPORT_PATTERN.test(sourceCode))
|
|
135
136
|
return null;
|
|
136
|
-
let wrapped =
|
|
137
|
+
let wrapped = ensureRegexUniversalImport(sourceCode);
|
|
137
138
|
wrapped = wrapped
|
|
138
139
|
.replace(LOAD_EXPORT_PATTERN, (match) => match.replace('export const load', 'const __userUniversalLoad'))
|
|
139
140
|
.concat('\n\nexport const load = __withEdgesUniversalLoad(__userUniversalLoad);');
|