Skip to content

Commit

Permalink
Revert "fix(repl): version detection (QwikDev#6791)"
Browse files Browse the repository at this point in the history
This reverts commit 1583bb5.
  • Loading branch information
maiieul committed Aug 27, 2024
1 parent d5e8ab7 commit 5920136
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions packages/docs/src/repl/monaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ export const addQwikLibs = async (version: string) => {
};

const loadDeps = async (qwikVersion: string) => {
const [M, m, p] = qwikVersion.split('-')[0].split('.').map(Number);
const isDev = qwikVersion.includes('dev');
const v = qwikVersion.split('-')[0].split('.').map(Number);
const prefix =
qwikVersion === 'bundled' || M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2)))
qwikVersion === 'bundled' || (v[0] >= 1 && v[1] >= 7 && v[2] >= (isDev ? 1 : 2))
? '/dist/'
: '/';
const deps: NodeModuleDep[] = [
Expand Down
5 changes: 3 additions & 2 deletions packages/docs/src/repl/repl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ export const receiveMessageFromReplServer = (
const getDependencies = (input: ReplAppInput) => {
const out = { ...bundled };
if (input.version !== 'bundled') {
const [M, m, p] = input.version.split('-')[0].split('.').map(Number);
const prefix = M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2))) ? '/dist/' : '/';
const v = input.version.split('-')[0].split('.').map(Number);
const prefix =
v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2))) ? '/dist/' : '/';
out[QWIK_PKG_NAME] = {
version: input.version,
};
Expand Down
3 changes: 1 addition & 2 deletions packages/docs/src/repl/worker/app-bundle-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export const appBundleClient = async (
debug: options.debug,
srcInputs: getInputs(options),
// Older versions don't support `segment`
entryStrategy:
options.entryStrategy.type === 'segment' ? { type: 'hook' } : options.entryStrategy,
entryStrategy: options.entryStrategy === 'segment' ? 'hook' : options.entryStrategy,
manifestOutput: (m) => {
result.manifest = m;
},
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/repl/worker/repl-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ let cache: Cache;
export const depResponse = async (pkgName: string, pkgPath: string) => {
if (pkgName === QWIK_PKG_NAME && !pkgPath.startsWith('/bindings')) {
const version = options.deps[pkgName].version;
const [M, m, p] = version.split('-')[0].split('.').map(Number);
if (M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2)))) {
const v = version.split('-')[0].split('.').map(Number);
if (v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2)))) {
pkgPath = `/dist${pkgPath}`;
}
}
Expand Down

0 comments on commit 5920136

Please sign in to comment.