vite 7.0.5 → 7.1.0-beta.0

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.
@@ -3,7 +3,7 @@ let SOURCEMAPPING_URL = "sourceMa";
3
3
  SOURCEMAPPING_URL += "ppingURL";
4
4
  const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP", isWindows = typeof process < "u" && process.platform === "win32";
5
5
  function unwrapId(id) {
6
- return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
6
+ return id.startsWith(VALID_ID_PREFIX) ? id.slice(5).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
7
7
  }
8
8
  const windowsSlashRE = /\\/g;
9
9
  function slash(p) {
@@ -94,7 +94,7 @@ function posixPathToFileHref(posixPath) {
94
94
  function toWindowsPath(path) {
95
95
  return path.replace(/\//g, "\\");
96
96
  }
97
- const comma = 44, semicolon = 59, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
97
+ const comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
98
98
  for (let i = 0; i < 64; i++) {
99
99
  let c = chars.charCodeAt(i);
100
100
  intToChar[i] = c, charToInt[c] = i;
@@ -111,7 +111,6 @@ function decodeInteger(reader, relative) {
111
111
  function hasMoreVlq(reader, max) {
112
112
  return reader.pos >= max ? !1 : reader.peek() !== comma;
113
113
  }
114
- const bufLength = 1024 * 16;
115
114
  var StringReader = class {
116
115
  constructor(buffer) {
117
116
  this.pos = 0, this.buffer = buffer;
@@ -239,10 +238,10 @@ function getOriginalPosition(map, needle) {
239
238
  let result = originalPositionFor(map, needle);
240
239
  return result.column == null ? null : result;
241
240
  }
242
- const MODULE_RUNNER_SOURCEMAPPING_REGEXP = RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
241
+ const MODULE_RUNNER_SOURCEMAPPING_REGEXP = /* @__PURE__ */ RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
243
242
  var EvaluatedModuleNode = class {
244
- importers = new Set();
245
- imports = new Set();
243
+ importers = /* @__PURE__ */ new Set();
244
+ imports = /* @__PURE__ */ new Set();
246
245
  evaluated = !1;
247
246
  meta;
248
247
  promise;
@@ -253,9 +252,9 @@ var EvaluatedModuleNode = class {
253
252
  this.id = id, this.url = url, this.file = cleanUrl(id);
254
253
  }
255
254
  }, EvaluatedModules = class {
256
- idToModuleMap = new Map();
257
- fileToModulesMap = new Map();
258
- urlToIdModuleMap = new Map();
255
+ idToModuleMap = /* @__PURE__ */ new Map();
256
+ fileToModulesMap = /* @__PURE__ */ new Map();
257
+ urlToIdModuleMap = /* @__PURE__ */ new Map();
259
258
  getModuleById(id) {
260
259
  return this.idToModuleMap.get(id);
261
260
  }
@@ -272,7 +271,7 @@ var EvaluatedModuleNode = class {
272
271
  }
273
272
  let moduleNode = new EvaluatedModuleNode(id, url);
274
273
  this.idToModuleMap.set(id, moduleNode), this.urlToIdModuleMap.set(url, moduleNode);
275
- let fileModules = this.fileToModulesMap.get(moduleNode.file) || new Set();
274
+ let fileModules = this.fileToModulesMap.get(moduleNode.file) || /* @__PURE__ */ new Set();
276
275
  return fileModules.add(moduleNode), this.fileToModulesMap.set(moduleNode.file, fileModules), moduleNode;
277
276
  }
278
277
  invalidateModule(node) {
@@ -299,7 +298,7 @@ const prefixedBuiltins = new Set([
299
298
  function normalizeModuleId(file) {
300
299
  if (prefixedBuiltins.has(file)) return file;
301
300
  let unixFile = slash(file).replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
302
- return unixFile.replace(/^file:\//, "/");
301
+ return unixFile.replace(/^file:\/+/, isWindows ? "" : "/");
303
302
  }
304
303
  var HMRContext = class {
305
304
  newListeners;
@@ -312,7 +311,7 @@ var HMRContext = class {
312
311
  let listeners = hmrClient.customListenersMap.get(event);
313
312
  listeners && hmrClient.customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
314
313
  }
315
- this.newListeners = new Map(), hmrClient.ctxToListenersMap.set(ownerPath, this.newListeners);
314
+ this.newListeners = /* @__PURE__ */ new Map(), hmrClient.ctxToListenersMap.set(ownerPath, this.newListeners);
316
315
  }
317
316
  get data() {
318
317
  return this.hmrClient.dataMap.get(this.ownerPath);
@@ -383,12 +382,12 @@ var HMRContext = class {
383
382
  }), this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
384
383
  }
385
384
  }, HMRClient = class {
386
- hotModulesMap = new Map();
387
- disposeMap = new Map();
388
- pruneMap = new Map();
389
- dataMap = new Map();
390
- customListenersMap = new Map();
391
- ctxToListenersMap = new Map();
385
+ hotModulesMap = /* @__PURE__ */ new Map();
386
+ disposeMap = /* @__PURE__ */ new Map();
387
+ pruneMap = /* @__PURE__ */ new Map();
388
+ dataMap = /* @__PURE__ */ new Map();
389
+ customListenersMap = /* @__PURE__ */ new Map();
390
+ ctxToListenersMap = /* @__PURE__ */ new Map();
392
391
  currentFirstInvalidatedBy;
393
392
  constructor(logger, transport, importUpdatedModule) {
394
393
  this.logger = logger, this.transport = transport, this.importUpdatedModule = importUpdatedModule;
@@ -473,7 +472,7 @@ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzr
473
472
  };
474
473
  function reviveInvokeError(e) {
475
474
  let error = Error(e.message || "Unknown invoke error");
476
- return Object.assign(error, e, { runnerError: Error("RunnerError") }), error;
475
+ return Object.assign(error, e, { runnerError: /* @__PURE__ */ Error("RunnerError") }), error;
477
476
  }
478
477
  const createInvokeableTransport = (transport) => {
479
478
  if (transport.invoke) return {
@@ -493,7 +492,7 @@ const createInvokeableTransport = (transport) => {
493
492
  }
494
493
  };
495
494
  if (!transport.send || !transport.connect) throw Error("transport must implement send and connect when invoke is not implemented");
496
- let rpcPromises = new Map();
495
+ let rpcPromises = /* @__PURE__ */ new Map();
497
496
  return {
498
497
  ...transport,
499
498
  connect({ onMessage, onDisconnection }) {
@@ -517,7 +516,7 @@ const createInvokeableTransport = (transport) => {
517
516
  },
518
517
  disconnect() {
519
518
  return rpcPromises.forEach((promise) => {
520
- promise.reject(Error(`transport was disconnected, cannot call ${JSON.stringify(promise.name)}`));
519
+ promise.reject(/* @__PURE__ */ Error(`transport was disconnected, cannot call ${JSON.stringify(promise.name)}`));
521
520
  }), rpcPromises.clear(), transport.disconnect?.();
522
521
  },
523
522
  send(data) {
@@ -534,7 +533,7 @@ const createInvokeableTransport = (transport) => {
534
533
  }
535
534
  }, sendPromise = transport.send(wrappedData), { promise, resolve: resolve$1, reject } = promiseWithResolvers(), timeout = transport.timeout ?? 6e4, timeoutId;
536
535
  timeout > 0 && (timeoutId = setTimeout(() => {
537
- rpcPromises.delete(promiseId), reject(Error(`transport invoke timed out after ${timeout}ms (data: ${JSON.stringify(wrappedData)})`));
536
+ rpcPromises.delete(promiseId), reject(/* @__PURE__ */ Error(`transport invoke timed out after ${timeout}ms (data: ${JSON.stringify(wrappedData)})`));
538
537
  }, timeout), timeoutId?.unref?.()), rpcPromises.set(promiseId, {
539
538
  resolve: resolve$1,
540
539
  reject,
@@ -598,7 +597,7 @@ const createInvokeableTransport = (transport) => {
598
597
  isOpened = !0, resolve$1();
599
598
  }, { once: !0 }), socket.addEventListener("close", async () => {
600
599
  if (!isOpened) {
601
- reject(Error("WebSocket closed without opened."));
600
+ reject(/* @__PURE__ */ Error("WebSocket closed without opened."));
602
601
  return;
603
602
  }
604
603
  onMessage({
@@ -701,7 +700,7 @@ function getModulesByFile(runner, file) {
701
700
  let nodes = runner.evaluatedModules.getModulesByFile(file);
702
701
  return nodes ? [...nodes].map((node) => node.id) : [];
703
702
  }
704
- function getModulesEntrypoints(runner, modules, visited = new Set(), entrypoints = new Set()) {
703
+ function getModulesEntrypoints(runner, modules, visited = /* @__PURE__ */ new Set(), entrypoints = /* @__PURE__ */ new Set()) {
705
704
  for (let moduleId of modules) {
706
705
  if (visited.has(moduleId)) continue;
707
706
  visited.add(moduleId);
@@ -715,17 +714,17 @@ function getModulesEntrypoints(runner, modules, visited = new Set(), entrypoints
715
714
  }
716
715
  return entrypoints;
717
716
  }
718
- function findAllEntrypoints(runner, entrypoints = new Set()) {
717
+ function findAllEntrypoints(runner, entrypoints = /* @__PURE__ */ new Set()) {
719
718
  for (let mod of runner.evaluatedModules.idToModuleMap.values()) mod.importers.size || entrypoints.add(mod.url);
720
719
  return entrypoints;
721
720
  }
722
- const sourceMapCache = {}, fileContentsCache = {}, evaluatedModulesCache = new Set(), retrieveFileHandlers = new Set(), retrieveSourceMapHandlers = new Set(), createExecHandlers = (handlers) => (...args) => {
721
+ const sourceMapCache = {}, fileContentsCache = {}, evaluatedModulesCache = /* @__PURE__ */ new Set(), retrieveFileHandlers = /* @__PURE__ */ new Set(), retrieveSourceMapHandlers = /* @__PURE__ */ new Set(), createExecHandlers = (handlers) => ((...args) => {
723
722
  for (let handler of handlers) {
724
723
  let result = handler(...args);
725
724
  if (result) return result;
726
725
  }
727
726
  return null;
728
- }, retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers), retrieveSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
727
+ }), retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers), retrieveSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
729
728
  let overridden = !1;
730
729
  const originalPrepare = Error.prepareStackTrace;
731
730
  function resetInterceptor(runner, options) {
@@ -912,15 +911,76 @@ var ESModulesEvaluator = class {
912
911
  runExternalModule(filepath) {
913
912
  return import(filepath);
914
913
  }
915
- }, ModuleRunner = class {
914
+ };
915
+ const customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/", customizationHooksModule = `
916
+
917
+ export async function resolve(specifier, context, nextResolve) {
918
+ if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) {
919
+ const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length)
920
+ const [parsedSpecifier, parsedImporter] = JSON.parse(data)
921
+ specifier = parsedSpecifier
922
+ context.parentURL = parsedImporter
923
+ }
924
+
925
+ return nextResolve(specifier, context)
926
+ }
927
+
928
+ `;
929
+ async function createImportMetaResolver() {
930
+ let module;
931
+ try {
932
+ module = (await import("node:module")).Module;
933
+ } catch {
934
+ return;
935
+ }
936
+ if (module?.register) {
937
+ try {
938
+ let hookModuleContent = `data:text/javascript,${encodeURI(customizationHooksModule)}`;
939
+ module.register(hookModuleContent);
940
+ } catch (e) {
941
+ if ("code" in e && e.code === "ERR_NETWORK_IMPORT_DISALLOWED") return;
942
+ throw e;
943
+ }
944
+ return (specifier, importer) => import.meta.resolve(`${customizationHookNamespace}${JSON.stringify([specifier, importer])}`);
945
+ }
946
+ }
947
+ const envProxy = new Proxy({}, { get(_, p) {
948
+ throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
949
+ } });
950
+ function createDefaultImportMeta(modulePath) {
951
+ let href = posixPathToFileHref(modulePath), filename = modulePath, dirname$1 = posixDirname(modulePath);
952
+ return {
953
+ filename: isWindows ? toWindowsPath(filename) : filename,
954
+ dirname: isWindows ? toWindowsPath(dirname$1) : dirname$1,
955
+ url: href,
956
+ env: envProxy,
957
+ resolve(_id, _parent) {
958
+ throw Error("[module runner] \"import.meta.resolve\" is not supported.");
959
+ },
960
+ glob() {
961
+ throw Error("[module runner] \"import.meta.glob\" is statically replaced during file transformation. Make sure to reference it by the full name.");
962
+ }
963
+ };
964
+ }
965
+ let importMetaResolverCache;
966
+ async function createNodeImportMeta(modulePath) {
967
+ let defaultMeta = createDefaultImportMeta(modulePath), href = defaultMeta.url;
968
+ importMetaResolverCache ??= createImportMetaResolver();
969
+ let importMetaResolver = await importMetaResolverCache;
970
+ return {
971
+ ...defaultMeta,
972
+ resolve(id, parent) {
973
+ let resolver = importMetaResolver ?? defaultMeta.resolve;
974
+ return resolver(id, parent ?? href);
975
+ }
976
+ };
977
+ }
978
+ var ModuleRunner = class {
916
979
  evaluatedModules;
917
980
  hmrClient;
918
- envProxy = new Proxy({}, { get(_, p) {
919
- throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
920
- } });
921
981
  transport;
922
982
  resetSourceMapSupport;
923
- concurrentModuleNodePromises = new Map();
983
+ concurrentModuleNodePromises = /* @__PURE__ */ new Map();
924
984
  closed = !1;
925
985
  constructor(options, evaluator = new ESModulesEvaluator(), debug) {
926
986
  if (this.options = options, this.evaluator = evaluator, this.debug = debug, this.evaluatedModules = options.evaluatedModules ?? new EvaluatedModules(), this.transport = normalizeModuleRunnerTransport(options.transport), options.hmr !== !1) {
@@ -952,7 +1012,7 @@ var ESModulesEvaluator = class {
952
1012
  for (let importedFile of mod.imports) if (mod.importers.has(importedFile)) return !0;
953
1013
  return !1;
954
1014
  }
955
- isCircularImport(importers, moduleUrl, visited = new Set()) {
1015
+ isCircularImport(importers, moduleUrl, visited = /* @__PURE__ */ new Set()) {
956
1016
  for (let importer of importers) {
957
1017
  if (visited.has(importer)) continue;
958
1018
  if (visited.add(importer), importer === moduleUrl) return !0;
@@ -1025,18 +1085,7 @@ var ESModulesEvaluator = class {
1025
1085
  let importer = callstack[callstack.length - 2];
1026
1086
  throw Error(`[module runner] Failed to load "${url}"${importer ? ` imported from ${importer}` : ""}`);
1027
1087
  }
1028
- let modulePath = cleanUrl(file || moduleId), href = posixPathToFileHref(modulePath), filename = modulePath, dirname$1 = posixDirname(modulePath), meta = {
1029
- filename: isWindows ? toWindowsPath(filename) : filename,
1030
- dirname: isWindows ? toWindowsPath(dirname$1) : dirname$1,
1031
- url: href,
1032
- env: this.envProxy,
1033
- resolve(_id, _parent) {
1034
- throw Error("[module runner] \"import.meta.resolve\" is not supported.");
1035
- },
1036
- glob() {
1037
- throw Error("[module runner] \"import.meta.glob\" is statically replaced during file transformation. Make sure to reference it by the full name.");
1038
- }
1039
- }, exports = Object.create(null);
1088
+ let createImportMeta = this.options.createImportMeta ?? createDefaultImportMeta, modulePath = cleanUrl(file || moduleId), href = posixPathToFileHref(modulePath), meta = await createImportMeta(modulePath), exports = Object.create(null);
1040
1089
  Object.defineProperty(exports, Symbol.toStringTag, {
1041
1090
  value: "Module",
1042
1091
  enumerable: !1,
@@ -1079,4 +1128,4 @@ function exportAll(exports, sourceModule) {
1079
1128
  } catch {}
1080
1129
  }
1081
1130
  }
1082
- export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
1131
+ export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "7.0.5",
3
+ "version": "7.1.0-beta.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -70,9 +70,9 @@
70
70
  "dependencies": {
71
71
  "esbuild": "^0.25.0",
72
72
  "fdir": "^6.4.6",
73
- "picomatch": "^4.0.2",
73
+ "picomatch": "^4.0.3",
74
74
  "postcss": "^8.5.6",
75
- "rollup": "^4.40.0",
75
+ "rollup": "^4.43.0",
76
76
  "tinyglobby": "^0.2.14"
77
77
  },
78
78
  "optionalDependencies": {
@@ -84,6 +84,7 @@
84
84
  "@jridgewell/trace-mapping": "^0.3.29",
85
85
  "@oxc-project/types": "0.77.0",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
+ "@rolldown/pluginutils": "^1.0.0-beta.29",
87
88
  "@rollup/plugin-alias": "^5.1.1",
88
89
  "@rollup/plugin-commonjs": "^28.0.6",
89
90
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
@@ -91,7 +92,7 @@
91
92
  "@types/escape-html": "^1.0.4",
92
93
  "@types/pnpapi": "^0.0.5",
93
94
  "artichokie": "^0.3.2",
94
- "baseline-browser-mapping": "^2.5.3",
95
+ "baseline-browser-mapping": "^2.5.6",
95
96
  "cac": "^6.7.14",
96
97
  "chokidar": "^3.6.0",
97
98
  "connect": "^3.7.0",
@@ -100,14 +101,14 @@
100
101
  "cross-spawn": "^7.0.6",
101
102
  "debug": "^4.4.1",
102
103
  "dep-types": "link:./src/types",
103
- "dotenv": "^17.2.0",
104
+ "dotenv": "^17.2.1",
104
105
  "dotenv-expand": "^12.0.2",
105
106
  "es-module-lexer": "^1.7.0",
106
107
  "escape-html": "^1.0.3",
107
108
  "estree-walker": "^3.0.3",
108
109
  "etag": "^1.8.1",
109
110
  "host-validation-middleware": "^0.1.1",
110
- "http-proxy": "^1.18.1",
111
+ "http-proxy-3": "^1.20.10",
111
112
  "launch-editor-middleware": "^2.10.0",
112
113
  "lightningcss": "^1.30.1",
113
114
  "magic-string": "^0.30.17",
@@ -115,7 +116,7 @@
115
116
  "mrmime": "^2.0.1",
116
117
  "nanoid": "^5.1.5",
117
118
  "open": "^10.2.0",
118
- "parse5": "^7.3.0",
119
+ "parse5": "^8.0.0",
119
120
  "pathe": "^2.0.3",
120
121
  "periscopic": "^4.0.2",
121
122
  "picocolors": "^1.1.1",
@@ -124,8 +125,8 @@
124
125
  "postcss-modules": "^6.0.1",
125
126
  "premove": "^4.0.0",
126
127
  "resolve.exports": "^2.0.3",
127
- "rolldown": "^1.0.0-beta.27",
128
- "rolldown-plugin-dts": "^0.13.13",
128
+ "rolldown": "^1.0.0-beta.29",
129
+ "rolldown-plugin-dts": "^0.14.1",
129
130
  "rollup-plugin-license": "^3.6.0",
130
131
  "sass": "^1.89.2",
131
132
  "sass-embedded": "^1.89.2",
@@ -15,8 +15,6 @@ export interface CustomPluginOptionsVite {
15
15
  * ```js
16
16
  * cssScopeTo: ['/src/App.vue', 'default']
17
17
  * ```
18
- *
19
- * @experimental
20
18
  */
21
19
  cssScopeTo?: readonly [importerId: string, exportName: string | undefined]
22
20
 
@@ -1,95 +0,0 @@
1
- (*
2
- Copyright (c) 2015-present, Facebook, Inc.
3
-
4
- This source code is licensed under the MIT license found in the
5
- LICENSE file at
6
- https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
7
- *)
8
-
9
- property targetTab: null
10
- property targetTabIndex: -1
11
- property targetWindow: null
12
- property theProgram: "Google Chrome"
13
-
14
- on run argv
15
- set theURL to item 1 of argv
16
-
17
- -- Allow requested program to be optional,
18
- -- default to Google Chrome
19
- if (count of argv) > 1 then
20
- set theProgram to item 2 of argv
21
- end if
22
-
23
- using terms from application "Google Chrome"
24
- tell application theProgram
25
-
26
- if (count every window) = 0 then
27
- make new window
28
- end if
29
-
30
- -- 1: Looking for tab running debugger
31
- -- then, Reload debugging tab if found
32
- -- then return
33
- set found to my lookupTabWithUrl(theURL)
34
- if found then
35
- set targetWindow's active tab index to targetTabIndex
36
- tell targetTab to reload
37
- tell targetWindow to activate
38
- set index of targetWindow to 1
39
- return
40
- end if
41
-
42
- -- 2: Looking for Empty tab
43
- -- In case debugging tab was not found
44
- -- We try to find an empty tab instead
45
- set found to my lookupTabWithUrl("chrome://newtab/")
46
- if found then
47
- set targetWindow's active tab index to targetTabIndex
48
- set URL of targetTab to theURL
49
- tell targetWindow to activate
50
- return
51
- end if
52
-
53
- -- 3: Create new tab
54
- -- both debugging and empty tab were not found
55
- -- make a new tab with url
56
- tell window 1
57
- activate
58
- make new tab with properties {URL:theURL}
59
- end tell
60
- end tell
61
- end using terms from
62
- end run
63
-
64
- -- Function:
65
- -- Lookup tab with given url
66
- -- if found, store tab, index, and window in properties
67
- -- (properties were declared on top of file)
68
- on lookupTabWithUrl(lookupUrl)
69
- using terms from application "Google Chrome"
70
- tell application theProgram
71
- -- Find a tab with the given url
72
- set found to false
73
- set theTabIndex to -1
74
- repeat with theWindow in every window
75
- set theTabIndex to 0
76
- repeat with theTab in every tab of theWindow
77
- set theTabIndex to theTabIndex + 1
78
- if (theTab's URL as string) contains lookupUrl then
79
- -- assign tab, tab index, and window to properties
80
- set targetTab to theTab
81
- set targetTabIndex to theTabIndex
82
- set targetWindow to theWindow
83
- set found to true
84
- exit repeat
85
- end if
86
- end repeat
87
-
88
- if found then
89
- exit repeat
90
- end if
91
- end repeat
92
- end tell
93
- end using terms from
94
- return found
95
- end lookupTabWithUrl